Variable Declaration in Swift
Level 271 keystrokes
Shows the difference between var (a variable that can change) and let (a constant), updates count and prints "Swift: 15".
Swift code
// var declares a variable whose value can change; its type is inferred as Int1var count = 10// let declares a constant; assigning to name again would be a compile error2let name = "Swift"// Allowed because count is a var: 10 + 5 = 153count += 5// \() inserts the values into the string: Swift: 154print("\(name): \(count)")Output
Swift: 15
Practice typing this code. Results are not recorded in the rankings.
Symbols in this code
The symbols you type in this Swift code and how often they appear.
"× 4(× 3)× 3=× 3\× 2:× 1+× 1