Every language needs variables. Swift has support for the following data types,
- Implicit types, Int, UInt, Float, Double
- Collection Types, Array and Dictionary
- Tuples, that are groupings of values, or can return multiple values from a single function
- Optional types, where you may not have a value, similar to nil pointer in ObjectiveC except optional types apply to both classes and value types, not just classes
When you declare a variable in Swift, you can declare it as a constant or a variable, as below
1: let iAmAConstant = 1
2: var iCanBechanged = "Changeable"
In the above example, the compiler has enough information to infer the data type you wish to provide. Sometimes you want to declare a variable, but provide the value later. This can be done as below,
1: var iCanBechanged:String, iCanAlsobeChanged:Int
2: iCanBechanged = "Ok I changed you"
3: iCanAlsobeChanged = 20
Concatenation of strings in SWIFT is really simple, like this,
1: var anotherString = "This is a complex string made up of \(iCanBechanged) and \(iCanAlsobeChanged)"