Tin

Examples · learn/08-collections · 142 of 339

sets

examples/learn/08-collections/sets.tintin run examples/learn/08-collections/sets.tin
fn main() {
  var seen: Set<string> = newSet()
  for word in "to be or not to be".split(" ") {
    seen.add(word)                        // adding again changes nothing
  }
  print(seen)
  print(seen.size())
  print(seen.has("or"))
  let ages = mapOf([("ada", 36), ("alan", 41)])
  for name, age in ages {
    print("{name} is {age}")
  }
}