Revision: 27399
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at June 5, 2010 17:20 by magicrebirth
Initial Code
//Loops
//For loop
   for (int y = 0; y < 3; y ) {
   NSLog(@\"y = %i\", y);
}
//Do loop
x = 0;
do{
   NSLog(@\"x = %i\", x);
   x ;
}
while(x <= 4);
//While loop
x = 0;
while (x <= 4 ) {
   NSLog(@\"x = %i\", x);
   x ;
}
//For each loop
//Create an array and add elements to it
NSMutableArray *anArray = [[NSMutableArray alloc] init];
[anArray addObject:@\"Element 1\"];
[anArray addObject:@\"Element 2\"];
[anArray addObject:@\"Element 3\"];
//Use a for each loop to iterate through the array
for (NSString *s in anArray) {
   NSLog(s);
}
//Release the array
[anArray release];
Initial URL
http://howtomakeiphoneapps.com/2009/04/examples-of-objective-c-loops-2/
Initial Description
Initial Title
Examples of Objective-C Loops
Initial Tags
Initial Language
Objective C