/ 100daysofswiftui

100 Days of SwiftUI — Day 4

Day 4 was about loops. I learned how to exit outer loops when using nested loops — you can use so called labels and break label and that's it:

outerLoop: for i in 0..<10 {
  for j in 0..<10 {
    if i*j == 16 {
      // do something
      break outerLoop
    }
  }
}

And again: I should read the tasks of the test more carefully. Most of the time I don't see that the code wouldn't run at all as a constants should be changed, for example.

100 Days of SwiftUI — Day 4
Share this