diff --git a/src/scratchpad/for_seqs b/src/scratchpad/for_seqs new file mode 100755 index 0000000..1e4f7d5 Binary files /dev/null and b/src/scratchpad/for_seqs differ diff --git a/src/scratchpad/for_seqs.nim b/src/scratchpad/for_seqs.nim new file mode 100644 index 0000000..15bdff9 --- /dev/null +++ b/src/scratchpad/for_seqs.nim @@ -0,0 +1,8 @@ +proc p(xs: seq[string]): int = + for i, x in xs: + if x == "c": + return i + return -1 + +let xs = @["a", "b", "c"] +echo p(xs) diff --git a/src/scratchpad/seqs.nim b/src/scratchpad/seqs.nim index 20f7a0f..e623412 100644 --- a/src/scratchpad/seqs.nim +++ b/src/scratchpad/seqs.nim @@ -1 +1,2 @@ echo @[ "1", "2" ] in @["1", "2", "3" ] +# ^ does not work.