Programming in Swift: Fundamentals

Oct 19 2021 · Swift 5.5, iOS 15, Xcode 13

Part 3: Control Flow

20. For Loops

Episode complete

Play next episode

Next
About this episode

Leave a rating/review

See forum comments
Cinema mode Mark complete Download course materials
Previous episode: 19. Challenge: While Loops Next episode: 21. Challenge: For Loops

Get immediate access to this and 4,000+ other videos and books.

Take your career further with a Kodeco Personal Plan. With unlimited access to over 40+ books and 4,000+ professional videos in a single subscription, it's simply the best investment you can make in your development career.

Learn more Already a subscriber? Sign in.

Notes: 20. For Loops

Update Notes: The student materials have been reviewed and are updated as of October 2021.

Heads up... You've reached locked video content where the transcript will be shown as obfuscated text.

So far, you’ve learned how to control the flow of execution in your apps using the decision-making powers of if statements and the while loop.

let closedRange = 0...5
let halfOpenRange = 0..<5
var usefulValue = 5
let closedRange = 0...usefulValue
let halfOpenRange = 0..<usefulValue

var sum = 0
let count = 10
for i in 1...count {
  
}
  sum += i 
i = 20
for _ in 1...count {
  print("roar")
}
for _ in 1...count where count > 100 {
  print("roar")
}
for i in 1...count { 

}
for i in 1...count {
   print("\(i) is an odd number.")
}
5 % 2
for i in 1...count where i % 2 == 1 {