Complete the code to create a stride from 0 to 10 with a step of 2.
for number in stride(from: 0, to: 10, by: [1]) { print(number) }
The stride(from:to:by:) function creates a sequence starting at 0, up to but not including 10, stepping by 2.
Complete the code to create a stride from 1 through 9 with a step of 2.
for number in stride(from: 1, through: 9, by: [1]) { print(number) }
Using stride(from:through:by:) with step 2 includes the last number 9 if it fits the sequence.
Fix the error in the stride to count down from 10 to 0 by 2.
for number in stride(from: 10, through: 0, by: [1]) { print(number) }
When counting down, the step must be negative. Here, -2 counts down by 2.
Fill both blanks to create a stride from 5 to 15 with a step of 3.
for number in stride(from: [1], to: [2], by: 3) { print(number) }
The stride starts at 5 and goes up to but not including 10, stepping by 3.
Fill all three blanks to create a stride from 20 down to 10 with a step of 2.
for number in stride(from: [1], through: [2], by: [3]) { print(number) }
The stride counts down from 20 through 10 by steps of -2.
