What is the advantage of using method over a veriable | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

What is the advantage of using method over a veriable

What is the advantage of using method over a veriable

16th Nov 2021, 1:14 PM
swamy
swamy - avatar
2 Answers
0
If you mean advantage of variable them 1-save time For example you want to use 133.045 them you don't want to type again and again The whole thing is make your program 2-easy to read and easy to use For example you wrote program 100 lines them you don't want to remember everything right? And 3-make your program reusable
16th Nov 2021, 1:40 PM
Yondaime
Yondaime - avatar
0
swamy First thing is both are used for different purpose so I don't think there is any comparison. variable is used to store value, it can be any type of value like integer, string, float and method is used to perform a task and it can be use for reusable code also. Method save your time for example if you are going to perform same task again and again then methods are useful.
16th Nov 2021, 1:53 PM
A͢J
A͢J - avatar