iOS Swift Collections and Control Flow Control Flow With Loops For In Loops

Monika Kesarwani
Monika Kesarwani
5,851 Points

can understand the question.. and how to write code according to question

For this challenge, we're going to use a for in loop to compute the multiplication table for 6 and append the results to an array.

Your task for this first step is to create a for in loop that iterates over a range. Multiplication tables typically range from 1 to 10 (with 10 included) so the range you are iterating over should go from 1 to 10. Note: Leave the body of the loop empty for this task.

For in loops also define a constant that temporarily stores the value in the iteration process. For the loop you're writing, name this constant multiplier.

// Enter your code below
var results: [Int] = []

1 Answer

16,353 Points

The question is asking to write a for/in loop to iterate over a range of 1 - 10 and name the local constant within the loop declaration "multiplier". For the first challenge, it says to leave the body empty.

for multiplier in 1...10 {