u can pass values to this function, what goods does that offer.
And for the return value, returning to that what good is that.
Err, still don't quite get the example.
Sorry about that, and the late reply.
I am deeply sorry.
Have you had to do a program that converts Celsius to Fahrenheit and vice-versa yet? Maybe something that calculates a standard deviation?
These small but frequently used modules, things that will take the same input and give a useful output, are frequently made as functions. This provides another layer of abstraction, and allows you to further modularize your code. It keeps you from writing the same code more than once.
In your example, this is useful because the grade will need to be calculated for each student. So instead of doing it by hand and possibly making mistakes, you can just put the grades into a file, and have it automatically calculated.
And how does it work, declaring a variable inside and another.
How to this help organizing app.
And how does this return work.
Plz help
When you declare a variable inside a function, you need to look at the rules of scope, which usually refer to the braces it is inside { }. When it's declared in a loop, after the loop exits, the variable (and it's value) are "forgotten" because that loop has ended. It's the same with a function, when it's done, the location is marked as free memory to be overwritten, which is why a return statement is necessary. You return the value you want to "remember" from the function.