December 2015
Intermediate to advanced
400 pages
13h 3m
English
Every town needs a name. Your town is fairly stable, so it will not be changing its name any time soon. Make the town name a constant of type String.
Listing 2.8 Giving the town a name
import Cocoa let numberOfStoplights: Int = 4 var population: Int population = 5422 let townName: String = "Knowhere"
It would be nice to have a short description of the town that the Tourism Council could use. The description is going to be a constant String, but you will be creating it a bit differently than the constants and variables you have created so far. The description will include all the data you have entered, and you are going to create it using a Swift feature called string interpolation.
String interpolation ...
Read now
Unlock full access