summary refs log tree commit diff stats
path: root/tests/ttuple1.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ttuple1.nim')
-rwxr-xr-xtests/ttuple1.nim16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/ttuple1.nim b/tests/ttuple1.nim
new file mode 100755
index 000000000..5787cc309
--- /dev/null
+++ b/tests/ttuple1.nim
@@ -0,0 +1,16 @@
+const romanNumbers = [
+    ("M", 1000), ("D", 500), ("C", 100),
+    ("L", 50), ("X", 10), ("V", 5), ("I", 1) ]
+
+var c = 0
+for key, val in items(romanNumbers):
+  inc(c)
+  stdout.write(key & "=" & $val)
+  if c < romanNumbers.len: stdout.write(", ") else: echo""
+#echo""
+
+proc PrintBiTuple(t: tuple[k: string, v: int]): int =
+  stdout.write(t.k & "=" & $t.v & ", ")
+  return 0
+  
+