One way or of another way, what I gonna say will help you remember that, and when I was making in the college, when use functions to designe programs, and doesn't work, I do it writing the program without function, because more then everything the program have to work no matter have or not a function to make it more lean, and one thing that is what make a function doesn't work, all that is inside of the function is local escope so doesn't work you try pull something outside the function, the only thing that make pick out of the function is the return, you can make a calcuation and say it to print it, that will happen when the function be invoked but, you see the result printed you can't use it, because the function do something you say to print and not to return it to you use of another way, so isn't a mistake is just that you limited the function to write the result, you didn't ask to return the result so is -> return bla bla bla. More that you make the calculation but you didn't say what to do with, doesn't gonna work or that you capsuled the result in a variable also doesn't work if you doesn't use the return the variable is local scope, you have to use the --> return. Rute Bezerra de Menezes Gondim
No comments:
Post a Comment