Skip to content
Cocoa Maker 4 - Loops and Goto episode artwork

Feb 22, 2010

Cocoa Maker 4 - Loops and Goto

from Cocoa Maker Hosted by Mr. Gecko

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 #import <Foundation/Foundation.h> 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 <Foundation/Foundation.h> 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

Episode details come from the podcast's RSS feed.

Embed this episode

Ready to play

Cocoa Maker 4 - Loops and Goto

No transcript yet.

Requests help us decide what to transcribe next.

AI, Government, and the Future Corner Alliance Welcome to AI, Government, and the Future, a podcast by Corner Alliance. We explore the intersection of artificial intelligence, government, and the future. Join us as we dive into the latest AI advancements, government policies, and innovative strategies to shape the future of our society. Whether you're a policy maker, venture capitalist, academic, or industry leader, this podcast will provide valuable insights and thought-provoking discussions to help you navigate the evolving landscape of AI and its impact on government. Tune in to AI, Government, and the Future to stay ahead in this transformative era. The Bootloader Paul Cutler and Tod Kurt A monthly podcast loading you up with news, project updates and product talk from the CircuitPython and maker communities. Hosted by Tod Kurt and Paul Cutler. Hack Learning Mark Barnes Learn quick and easy ways to improve education, leadership, and parenting: How to replace traditional homework; how to improve leadership; how to integrate new technology; how to assess for learning; how to eliminate useless meetings; how to engage even the most reluctant learners; how to inspire a lifelong love of reading; how to combine writing with the maker space; how to take learning mobile; how to improve social media strategies. Teacher/author/global influencer Mark Barnes, creator of the Bestselling Hack Learning Book Series, explains precisely what's wrong with education and what you can do about it, tomorrow; because you don't need a 5-year plan. Learn more at http://10publications.com.

Frequently asked questions

When was this Cocoa Maker episode published?

This episode was published on February 22, 2010.

Can I download this Cocoa Maker episode?

Yes. Use the download control on the episode player to save the publisher-provided media file.