Cocoa Maker 4 - Loops and Goto
MP4•Laman utama episod
Manage episode 155736469 series 1166832
Kandungan disediakan oleh Mr. Gecko. Semua kandungan podcast termasuk episod, grafik dan perihalan podcast dimuat naik dan disediakan terus oleh Mr. Gecko atau rakan kongsi platform podcast mereka. Jika anda percaya seseorang menggunakan karya berhak cipta anda tanpa kebenaran anda, anda boleh mengikuti proses yang digariskan di sini https://ms.player.fm/legal.
James (MrGeckosMedia.com), joined by, Eduardo (MegaEduX.com), and Karl, teaches how loops, arguments, and goto works in Cocoa.
15:35
Example code from episode.
Loops Example
Keynote used in this Episode
Keynote in PDF Format
…
continue reading
15:35
Example code from episode.
Loops Example
#import int main (int argc, const char * argv[]) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; int i=0; while (i!=2) { NSLog(@"%d", i); i++; } i=0; do { NSLog(@"%d", i); i++; } while (i!=3); NSArray *anArray = [NSArray arrayWithObjects:@"Apples", @"Oranges", @"Grapes", @"Bananas", nil]; for (int d=0; d<[anArray count]; d++) { NSLog(@"%@", [anArray objectAtIndex:d]); } NSString *theObject; for (theObject in anArray) { NSLog(@"For In: %@", theObject); } NSEnumerator *theEnumerator = [anArray objectEnumerator]; while (theObject = [theEnumerator nextObject]) { NSLog(@"Enumerator: %@", theObject); } [pool drain]; return 0; }Goto Example
#import void testGoto() { NSString *theString = [NSString new]; if (1==12) { goto Error; } goto Cleanup; Error: NSLog(@"An error occurred"); goto Cleanup; Cleanup: NSLog(@"Releasing the string"); [theString release]; } int main (int argc, const char * argv[]) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; testGoto(); [pool drain]; return 0; }
Keynote used in this Episode
Keynote in PDF Format
7 episod