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 Basics Swift Types String Manipulation

Sandeep Krishnan
Sandeep Krishnan
9,730 Points

let name = "Sandeep" let greeting = "\(" Hi there"), \(name) \(".")" let finalGreeting = greeting + "," + "How are you

Please help me. I am so think, unable to write simple swift code

strings.swift
let name = "Sandeep"
let greeting = "\(" Hi there"), \(name) \(".")"
let finalGreeting = greeting + "," + "How are you ?"

4 Answers

You are over-complicating this challenge. All you need to do is:

let name = "Sandeep"
let greeting = "Hi there, \(name)"
let finalGreeting = "\(greeting), How are you?"

I hope this helps you :)

Good luck! ~Alex

Sandeep Krishnan
Sandeep Krishnan
9,730 Points

Aha there you go. scratching my head :) thank you

You're welcome! :)

Sandeep Krishnan
Sandeep Krishnan
9,730 Points

Hi Alex, Since you have quite kind to explain, i have bit of an esoteric question. I am learning both python and Swift. But I am undecided to choose. Both look very similar syntaxically but I love the playground (instant feedback). what is your opinion on the future of programming and which one will do best for a beginner. I am conscious that Swift has been made open source recently so it can now extend beyond ISO platform. I am also aware that being a new language its evolving and some of the chatter on internet elude to Swift developer struggling with constant changes in Swift version s and this its functionalities.

It's up to you. If you enjoy coding in Swift you may continue. However, with Swift you can only make iOS apps. With Python, you can create applications, games (not on phones unfortunately), websites, even physical robots! If you want, you can also learn both. I think both Python and Swift are great, so it's hard choice. I hope you are able to decide now! :smile:

~Alex

Sandeep Krishnan
Sandeep Krishnan
9,730 Points

thank you. I am quite keen to learn Machine learning and Robotics. I have heard very many good things about python and it libraries. I think I will stay with python and learn Swift for hobby (until it stabilizes). I am already learning JavaScript as my first preference for Webdevelopment and gaming apps :)

thanks Alex, you have been great support

You're welcome! :)