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 Basics (retired) Control Flow For-In Loop

how do you do this

help

for_loops.swift
for item in 1...10 {
  print("\item"*2)
  }

2 Answers

Greg Kaleka
Greg Kaleka
39,021 Points

Hi Paulina,

Brian's answer is close. You need to wrap the mathy part in parentheses. For the challenge, you'll actually need both versions of the print statements Brian suggested. However, you need to use println so it prints each time on a new line, and you need to escape the parentheses. You also should be multiplying by 7, not 2, per the challenge.

for_loops.swift
for item in 1...10 {
    println("\(item) * 7 = \(item*7)")
}

youre just mis-using the parentheses. like this i believe----- Println("(item)*2") ----- to get "4*2" or use ------ ---------Println("(item*2)") to get "8"

hope it helped