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) Variables and Constants Constants

I need the answer of this challenger Task In order to understand how it works/ some videos explain g another I get lost

I just can't get it what to do I'm feel confuse, same happen to some student ? when they star? I feel like some how some one put me a stop break to learn, and then another Task press gas for speed to learn,

constants.swift
var str : String = "Hello"
let modernProgrammingLanguage: String = "Swift"
var greeting = str + modernProgrammingLanguage // implicit type String or inferred type String 

2 Answers

Daniel Sattler
Daniel Sattler
4,867 Points

Like this you variable greeting would print "HelloSwift"

In order to get "Hello Swift" you need to do either of this two:

var greeting = str + " " + modernProgrammingLanguage

var anotherGreeting = "\(str) \(modernProgrammingLanguage)"

to get an empty space between those two words.

I hope i understood your question correct.

This is perfect even if no is correct because I din't give you the correct question, but now I understand how it works or a list I have a good idea, I know a little (html) is about code same like this one, before I star looking on the web or any book about code, did you know any web site that I could see all the code or any good book that have just the "code" so before I make any question here I check the code and tried to figure out what to put, I just tried 4 different videos some explain very good about the codes that I don't need codes, they tell you right there but some others I don't get it, that's when I will look on some book?. I see that some one watch some video like 50 times, and they don't get it. with your help then I will figure out what I did wrong. or what I need to do next. Thank you for your help.