Return Are Reference Types

Run Settings
LanguageSwift
Language Version
Run Command
func makeIncrementer(forIncrement amount: Int) -> () -> Int { var runningTotal = 0 func incrementer() -> Int { runningTotal += amount return runningTotal } return incrementer } let incrementByTen = makeIncrementer(forIncrement: 10) incrementByTen() // returns a value of 10 incrementByTen() // returns a value of 20 incrementByTen() // returns a value of 30 let incrementBySeven = makeIncrementer(forIncrement: 7) incrementBySeven() // returns a value incrementByTen() // returns a value of 40 incrementBySeven() // returns a value of 14 let alsoIncrementByTen = incrementByTen alsoIncrementByTen() // returns a value of 50 incrementByTen() // returns a value of 60
Editor Settings
Theme
Key bindings
Full width
Lines