Join Scott Gardner for an in-depth discussion in this video Use labels, part of Swift 3 Essential Training: Beyond the Basics.
- [Instructor] Looping unconditional statements…can be labeled and used in conjunction…with the continue or break control transfer statements.…To transfer program flow to specific labeled statements,…I'm starting off with the variable i equal to zero…and a string constant hello equal to Hello, playground!…I'll write a do statement,…and in it first I'll increment i by one.…Then I'll nest another do statement…to create a nested scope.…
And in the nested do I'll print hello.…And I'll follow that with an if statement…to check if i is less than three.…If i is less than three, I want control to transfer it…back to the start of the outer do statement.…To do this, I'll first add a label to that do statement…by writing a label name I want to use, followed by a colon.…Then I'll add a continue control transfer statement…with the label I want to continue to.…
And in the console you can see that hello…is printed three times.…In essence I've created a loop…without writing a single loop statement.…
- Adding source files, resources, links, and literals
- Adding pages to a playground
- Using overflow operators and bitwise operators
- Using ranges with strings
- Creating complex sequences
- Chaining higher-order functions
- Defining lazy properties
- Using failable initializers
- Mutating methods
- Working with singletons
- Nesting function types
- Creating error types and recursive enumerations
- Extending concrete types
- Referencing selectors and key paths
- Working with protocol-oriented programming
- Defining class-only protocols and optional protocols
- Using option sets, type checking, and casting operators
Skill Level Intermediate
Core Data for iOS and macOS Enterprise Developerswith Jon Bott1h 46m Intermediate
Distributing Your iOS App for Testing with TestFlightwith Ron Buencamino35m 10s Intermediate
iOS App Development: Test-Driven Developmentwith Harrison Ferrone2h 14m Intermediate
3. Strings and Characters
4. Sequences and Collections
5. Control Flow
6. Value and Reference Types
9. Access Control
Understand access control3m 47s
Next steps1m 2s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.