+ 2

methods

sorry for the stupid question, but i can't understand methods. pls help

6th Jul 2018, 4:24 PM
ACAB\\ Mela BAKAta
ACAB\\ Mela BAKAta - avatar
4 Réponses
+ 1
They're just sections of code that performs a particular function. If it helps, think of them as "actions." For example, maybe my method is to add two numbers; or it's an action of adding numbers. I would send my numbers to the method, it would perform the action, and then it would return the result to me. Basically, we use methods because it allows us to write code once and reuse it wherever we see fit. This prevents you from having to constantly rewrite the same code that's used in multiple places. Good rule of thumb: if you're having to rewrite the same block of code, turn it into a method/function.
6th Jul 2018, 4:32 PM
Fata1 Err0r
Fata1 Err0r - avatar
6th Jul 2018, 4:42 PM
Maninder $ingh
Maninder $ingh - avatar
+ 1
thank you so much! so.. they are basically functions?
6th Jul 2018, 4:42 PM
ACAB\\ Mela BAKAta
ACAB\\ Mela BAKAta - avatar
+ 1
thanks!
6th Jul 2018, 4:44 PM
ACAB\\ Mela BAKAta
ACAB\\ Mela BAKAta - avatar