Cristian Contreras
Cristian Contreras

Reputation: 21

What is a subroutine as it pertains to Objective-C?

I started learning programming about 8 months ago, started with C, OOP, now onto iOS, which is my goal. Everything is going pretty smooth for the most part and I've started to practice by programming small applications on xcode. It's just little terms like subroutine that sometimes throw me off. Can anyone define this term for me and just give me a quick example of its usage? I know it is some type of method, and I completely understand instance and class methods, however I don't know exactly what the difference between a subroutine and an instance/class method is. I've looked online but not much luck.

Any help is appreciated, thanks

Upvotes: 1

Views: 319

Answers (2)

echristopherson
echristopherson

Reputation: 7074

"Subroutine" is a sort of old-fashioned term that means a piece of code that some other code calls into. Methods, functions, and procedures are some specific types of subroutines.

Upvotes: 2

Donal Fellows
Donal Fellows

Reputation: 137717

A method is a type of subroutine that is bound to a particular object for context state and lookup purposes. Objective-C also has general functions (same syntax as standard C) which are much more like the classic definition of subroutine.

Upvotes: 1

Related Questions