iphone app
variable
var i = 10
constant
let constant = "constant"
If the initial value dosent provide enough info. then we can write a type seperated by colon
let value: Double 10
option click on variable gives the variable information
Values as never implicitly converted as in java
let widthLabel = label + String(width)
note (String)width even if width is an integer you have to tell compiler to convert it to String
You can use string interpolation to include values in string \(String)
let appleSummary = "I have \(apples) apples."
optionals are values that might be nil so you declare them with ? let i:Int? = 10. i is int type but is optional, it can be nil
let optionalInt: Int? = 9
You can extract the value of optional with a bang !
let anotherInt:Int = optionalInt!
possibleInt = "banana" var myString = (Int)possibleInt
In above case myString is nil
var aList = ["a","b","c","d"]
aList[0] = "z"