ttuple1.nim 376 B

1234567891011121314151617
  1. const romanNumbers = [
  2. ("M", 1000), ("D", 500), ("C", 100),
  3. ("L", 50), ("X", 10), ("V", 5), ("I", 1) ]
  4. var c = 0
  5. for key, val in items(romanNumbers):
  6. inc(c)
  7. stdout.write(key & "=" & $val)
  8. if c < romanNumbers.len: stdout.write(", ") else: echo""
  9. #echo""
  10. proc PrintBiTuple(t: tuple[k: string, v: int]): int =
  11. stdout.write(t.k & "=" & $t.v & ", ")
  12. return 0