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

For In Loop

I honestly am not sure what to do

any advice will help

loops.swift
// Enter your code below
var results: [Int] = [6]
for multiplier in 1...10{
Print("\"(multiplier) times 6 is equal to \
(multiplier * 6)"}

2 Answers

I think you have three minor issues in your code.

First, you should write print instead of Print. Second, there are three double quotes " in your expression, but only two are needed. And third, the closing brace ) of your print statement is missing.

Then it should work. :)

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,860 Points

Hey Kevin. Welcome to Treehouse.

There are actually a few things with the code. The challenges are very picky and specific. You'll need to read the second part of the Task carefully.

+First, there shouldn't be a value hard coded into the array that was made and included in the opening challenge, so you need to remove the 6 you added.

+Second, Stefan is correct in his corrections, but the challenge did not ask for a print statement, so that needs to be deleted. The challenge only wants you to add (append()) the results of the multiplier multiplied by 6 to the array.

So, you are on the right track and the syntax for your for in loop is correct, it just need to append, not print.

var results: [Int] = []
for multiplier in 1...10{
  results.append(multiplier * 6)
}

Keep Coding! :)