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 trialTim Creed
Courses Plus Student 2,975 Pointsprintln issue in array challenge
How can I get past this issue with Swift Basics - Arrays - Challenge - Task 2 of 2 The challenge states to use the println statement which is not supported in Xcode 7. It compiles and works in Xcode but the challenge cannot be completed because I din't use println.
var todo: [String] = ["Learn Swift","Build App","Deploy App"]
print("The number of items in the array is \(todo.count)")
1 Answer
Steve Hunter
57,712 PointsHi there,
My Xcode 7 works fine with println
. I think the method is deprecated, not illegal.
I don't think the compiler behind the challenge is updated yet, so print
probably won't work. But println
will. Do bear in mind that the tests behind the challenge are expecting to see a simple output - 3 - not a long string.
So, the final line of the challenge needs to be:
println(todo.count)
Hope that helps.
Steve.
Tim Creed
Courses Plus Student 2,975 PointsTim Creed
Courses Plus Student 2,975 PointsThanks, guess I was overthinking the challenge. In the playground in Xcode, if I type println I immediately get an error and says to change to print.
Steve Hunter
57,712 PointsSteve Hunter
57,712 PointsHow strange - I get no errors but I may have turned such things off a while ago!
In each challenge just do exactly what it asks; don't even replicate what the previous video had you do. The questions are asked in their entirety and there's no points for any extras!
I hope you make good progress and if you run into any difficulties, just shout in here!
Steve.