DEV Community


100 Days of SwiftUI — Day 4

Nathan Mattes
By day, I'm an iOS developer. By night, I'm a human being/programmer/blogger/podcaster. ¯\_(ツ)_/¯, (-‸ლ) (╯°□°)╯︵ ┻━┻
Originally published at on ・1 min read

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.

Discussion (0)