Examples · learn/09-closures · 151 of 339
pipe
tin run examples/learn/09-closures/pipe.tinfn main() {
let orders = [12, 250, 40, 8, 99]
// x |> f(y) means f(x, y). Read it top to bottom, like a recipe.
let bigTotal = orders
|> filter((n) => n >= 40)
|> map((n) => n * 2)
|> sum()
print(bigTotal)
// the same thing, nested inside out:
print(sum(map(filter(orders, (n) => n >= 40), (n) => n * 2)))
}