summary refs log tree commit diff stats
path: root/tests/titer3.nim
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2009-06-08 08:13:09 +0200
committerAndreas Rumpf <rumpf_a@web.de>2009-06-08 08:13:09 +0200
commit36818817bd61594ea6d106328bb8df0f5a25cfc4 (patch)
tree58180069c9a32400e7e11ba5bc5c85be2f11f0cc /tests/titer3.nim
parent4d4b3b1c04d41868ebb58bd9ccba7b303007e900 (diff)
downloadNim-36818817bd61594ea6d106328bb8df0f5a25cfc4.tar.gz
version0.7.10
Diffstat (limited to 'tests/titer3.nim')
-rw-r--r--tests/titer3.nim7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/titer3.nim b/tests/titer3.nim
new file mode 100644
index 000000000..b42113241
--- /dev/null
+++ b/tests/titer3.nim
@@ -0,0 +1,7 @@
+# yield inside an iterator, but not in a loop:
+iterator iter1(a: openArray[int]): int =
+  yield a[0] #ERROR_MSG 'yield' only allowed in a loop of an iterator
+
+var x = [[1, 2, 3], [4, 5, 6]]
+for y in iter1(x[0]): write(stdout, $y)
+