New course! Every coder should learn Generative AI!
Try a free lesson+ 1
what is method?
3 Answers
+ 1
I don't know how to explain.. I'll try.
a method is like a group of code that returns a type of data (bool, int, and stuff), and this group of code has a name. Using this name, you call the method so you don't have to write the code over and over again...
that's basically what it is.
hope I didn't get you more confused....
+ 1
A method or a function is a collection of code that performs a given task.
The goal of its existence is to write more sophisticated code - to not duplicate existing lines. If you perform the same calculation multiple times, instead of writing the same calculation over and over again - write a method. Then you will be able to use prompt it whenever you are required.
I strongly sugguest reading this lesson again if you need for information or visit MSDN.
- 1
simple method is the way of doing work if you want to do same work need not to writer whole code just call the method it comes with in the class