+ 1
Are functions more efficient?
So my question is basically: Are functions more efficient? I mean, in the lessons and projects there were many exercises where we had to use functions but they could have been done without using them. Or are functions used mainly to make it easier to navigate through the code. Ex. Making calculations, then only just calling them.
3 Respostas
+ 6
The main purpose of functions is reusability. For example if you have to do the same thing twenty times it is more efficient to write a function once and call it twenty times.
+ 3
For smaller program you might be wondering that why we are using functions whether we can do it without using functions
But in large program when you need to excute a similar type of functionality for several times then function plays it's real role, cause writing similar types of program for a large number of times is never gonna efficient.
+ 2
Thank you!