Examples · learn/09-closures · 148 of 339
closure
tin run examples/learn/09-closures/closure.tinfn main() {
// (x) => ... is a function without a name: a closure
let inc = (x: int) => x + 1
print(inc(41))
let bonus = 10
let addBonus = (score: int) => score + bonus // it can use names from around it
print(addBonus(80))
}