Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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

Rahul Nair
Rahul Nair
519 Points

I'm not understanding the error!

The error says that I must declare a constant named multiplier but I have already named constant multiplier. Please help me?!

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

3 Answers

Ben Masel
Ben Masel
2,004 Points

I'm not completely sure if this is an answer but i think it means a for in loop constant, like: for multiplier in {(Random Code)} These are just clues so if you need more help at this just comment. Hope this helps!

let multiplier : [Int]

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Benjamin Masel is correct. The constant they are referring to is the one to be set up in your for loop. Like so:

for multiplier in 1...10 {
  // insert code here
}

edited for additional comment

When we set up a for loop you can think of this as a temporary variable/constant declaration. The reason this is "temporary" is that multiplier will only exist during the execution of the loop. When the loop stops, it disappears. Hope this helps! :sparkles: