let
to make a constant (immutable)var
to make a variable (Mutable)TypeInference
- let myAge = 35 //Integter
- let myName = "Girish " //Stign
- let temp = 87.5 //floating point
- let isValid = true // Boolean
type annotation
- let friend: String = "Girish "
Inbuilt functions
string
// String functions
myName.uppercased()
myName.lowercased()
myName.capitalized // this is present in foundation package
myName.isEmpty
myName.hasPrefix("Gi")
let firstName = "Girish"
let lastName = "V"
let age = 29
firstName + lastName // only strings can get joined if there is other type then use below format
"My name is \(firstName) \(lastName) and age is \(age)"