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

Sean Alves
Sean Alves
841 Points

Any help with this? I can't seem to find the solution

Challenge Task 2: I need to append the first 10 multiples of 6 to the results var

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

for multiplier in 1...10 {
    print("\(multiplier) times 6 is equal to \(multiplier * 6)")
}

results.append()

1 Answer

Justin Begley
Justin Begley
2,756 Points

Found the answer here: https://teamtreehouse.com/community/make-sure-the-results-array-contains-the-first-10-multiples-of-6

var results: [Int] = []

for multiplier in 1...10 {
    let result = multiplier * 6
    results.append(result)
}