why would we use the function inside a function?
can you plz tell some example? what are benefits?
Function inside function
It’s just that it makes it easy for programmers to get the context of what is happening in each function and makes grouping better.
For eg, you are building different function for each subject:
Chemistry has a function called experiment(element1, element2) it adds element1 and element2 and returns it: experiment(“Na”, “Cl”) would return “NaCl”
Maths has a function calculator() that can contain many function in it like add(), multiply() and divide(). So it makes it easy for us to group functions without using classes
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.