Whats the difference between a method () and a function () | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Whats the difference between a method () and a function ()

I know you call them so that you don't rewrite the same code all the time. but I don't know the difference

20th Apr 2018, 3:47 AM
Avinash
Avinash - avatar
4 Answers
+ 5
A function is outside a class. A method is a function, but inside a class.
20th Apr 2018, 3:49 AM
Emma
0
How to create a function outside a class? This is the explanation I thought of: https://stackoverflow.com/questions/155609/difference-between-a-method-and-a-function
20th Apr 2018, 4:48 AM
Jonas Schröter
Jonas Schröter - avatar
0
both are same
21st Apr 2018, 6:49 AM
Subham Kumar Sahu
Subham Kumar Sahu - avatar
0
methods are fuctions that runs on objects
24th Apr 2018, 3:38 AM
Hamed Varmazyar
Hamed Varmazyar - avatar