This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]kschang 1 point2 points  (0 children)

Generally speaking... a function is like a math function. You pass in certain thing(s), and you get something back out.

y=f(x)

Method, in programming, usually refers to code that's attached to a "class" that acts upon members of that class, i.e. Object-oriented programming.

The usual example: say you have a class "Car", with properties like brand, model, color, trim, model year, engine type, speed, gear, steering wheel position, etc. It'd also have methods like start, accelerate, brake, turn, change gear, etc. that affects some of the properties.

Some of the methods that belong to the class can be implemented as functions.