I am new to learning Swift and am trying to solve a challenge in Swift Programming: The Big Nerd Ranch Guide (1st Ed.). The question is in Chapter 6 about using a nested loop:
Use a loop to count by 2 from 0 to 100. Use another loop to make sure the first loop is run 5 times. Hint: one good way to do this is to use a nested loop.
I think I've found the answers but a bit unsure, any advise would be much appreciated!
for i in 1...5 {
for i in 0...100 {
if i % 2 == 0 {
print(i)
}
}
}
i, for both loops. That is confusing.ithen simply shadows the outeri.