+ 1
What is the purpose of using functions? Could anyone explain that?
4 Réponses
+ 2
Not to repeat code. For ex. you wouldn't want to write 10 exactly the same lines of code more than once in your main code. That is where functions come in. Not only does it simplify to only 1 short line of code, it also allows you do to calculations and/or other complex things with variables with ease.
+ 1
thanx so much
+ 1
One other benefit is that if you expect errors or other thinga in your code, you have to change it only once
+ 1
if you have some operations "gathered" as functions, you can store definitions somewhere on the bottom of the code and use only their names. It os much easier to handle with coding espwcially if you want to change something later on. The program is easier to understand also for others. Moreover its essential for work in groups. One man writes "body", other one does functions needed. The only infomation needed to pass on is the parameters.