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
Kolya Masayev
Courses Plus Student 323 PointsVersions of XCode
I am using the latest XCode and comparing to the one in the videos, it is different with some things.
for instance: my xcode does not understand println; while yours do. Secondly, my xcode does not understand #name (to repeat the name twice), it gives me the error and makes me to write two same words.
is there something wrong???
1 Answer
Steve Hunter
57,712 PointsHi Kolya
No, there's nothing wrong with your version of Xcode, but the latest releases of Swift have changed a few things. As Paul said above, you can use print rather than println now, it will include the new line. To avoid the new line being aded, put an optional terminator: "" in the statement.
Some of the naming conventions have changed too, yes. So, you no longer need the hash symbol(#) but can name a parameter for use in the calling of the method differently to its use inside the code:
func nameTest(paramName codeName: String) -> String {
print(codeName, terminator: "")
return codeName // use this in code
}
let test = nameTest(paramName: "Steve") // use this as a param name
let test2 = nameTest(paramName: "Hunter")
// printed output is:
SteveHunter // no space, no new line
I hope that helps explain a few of the differences.
Steve.
Paul Satem
1,022 PointsPaul Satem
1,022 Pointsprint and println function has been merged to a single method in Swift2.
just use print("blah blah") and not println("blah blah")