@interface HelloWorld : NSObject
- (NSString *)hello:(NSString *)name;
@end
@implementation HelloWorld
- (NSString *)hello:(NSString *)name {
if (!name) { name = @"World"; }
return [NSString stringWithFormat:@"Hello, %@!", name];
}
@end
Objective-C is a thin layer on top of C, and is a "strict superset" of C, meaning that it is possible to compile any C program with an Objective-C compiler, and to freely include C language code within an Objective-C class. Objective-C derives its object syntax from Smalltalk. All of the syntax for non-object-oriented operations (including primitive variables, pre-processing, expressions, function declarations, and function calls) is identical to that of C, while the syntax for object-oriented features is an implementation of Smalltalk-style messaging.
You can find more information about the language and its history here.
Join the Objective-C trackThe reviews are incredibly helpful because they help me see things that I missed, learn about new ways and sometimes interesting discussions that can add a fun twist to maybe a simple problem.
Once you join the Objective-C language track, you will receive support and feedback from our team of mentors. Here are the bios of a few of the mentors of this track.
These are a few of the 51 exercises on the Objective-C track. You can see all the exercises here.