Objective C #1 - Return Values

August 23, 2006 by Gabe | [mmd] |

Recently I began to teach myself Objective C. My final goal is to program in Cocoa for the Mac. The process is slow going, but really interesting. I'm adding a regular section to highlight some of my thoughts about learning a programming language. The first post is about "Return Values"

-(void) setNumerator;

This expression declares a new method that is not expected to return anything (i.e. void)

-(double) myNumber;

declares a method that should be returning a double precision number

-(int) getNumber;

should return an integer.

All this is very cool. It makes it pretty easy to see what kind of result should come back when the method is put into action. While it's not as direct as Ruby, I'm getting it. I'm even more green with Ruby, but I've heard such great things about it, that I had to check it out. I highly recommend this quirky but entertaining guide.

Technorati Tags: , , ,