Swift 6 · Basics and optionals

Constants and variables

let is constant and var can change. Types are inferred.

let name = "Ada"
var score = 0
score += 10
print("\(name) scored \(score)")

Official Swift 6 documentation

More basics and optionals commands

All basics and optionals commands · Swift 6 cheatsheet

Was this page helpful?