theritically, i want to know the differences
A function is a stand alone block of code. It is defined outside of any class and can be called directly by its name , and ​A method is a function that belongs to an object or a class. It represents the behavior of that specific entity.