Q. What is the significance of having functions in a program?
Answer =
Creating functions in programs is very useful. It offers the following
advantages:
(i) The program is easier to understand:
Main Block of the program becomes compact as the code of functions is not a
part of it and, thus, it is easier to read and understand.
(ii) Redundant code is at one place, so making changes is easier:
Instead of writing code again when we need to use it more than once, we can
write the code in the form of a function and call it more than once. If we
later need to change the code, we will need to change it in one place only.
Thus, it saves our time also.
(iii) Reusable functions can be put in a library in modules:
We can store the reusable functions in the form of a module. These modules can
be imported and used when needed in other programs.
Post a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )