Tin

Examples · learn/09-closures · 150 of 339

map-filter

examples/learn/09-closures/map-filter.tintin run examples/learn/09-closures/map-filter.tin
fn main() {
  let prices = [4.0, 12.5, 7.25, 30.0]
  print(prices.map((p) => p * 1.2))               // change every item
  print(prices.filter((p) => p < 10.0))           // keep some items
  print(prices.any((p) => p > 25.0))
  print(prices.count((p) => p > 5.0))
  print(prices.find((p) => p > 10.0))
}