History variables: Difference between revisions

add swift
m (→‎version 1: removed the "style" from the PRE html tag.)
(add swift)
Line 1,376:
x history.
</lang>
=={{header|Swift}}==
Swift does not support history variables. However, you can add a watcher that can track when the variable will change.
<lang Swift>var historyOfHistory = [Int]()
var history:Int = 0 {
willSet {
historyOfHistory.append(history)
}
}
 
history = 2
history = 3
history = 4
println(historyOfHistory)</lang>
 
=={{header|Tcl}}==