methods | SoloLearn: Learn to code for FREE!

+2

methods

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

7/6/2018 4:24:33 PM

ACAB\\ Mela BAKAta

4 Answers

New Answer

+2

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.

+2

answer in detail. https://www.quora.com/How-could-you-explain-what-is-a-Method-in-programming

+1

thank you so much! so.. they are basically functions?

+1