tweak: iteration over element and index in scratchpad.

This commit is contained in:
NunoSempere 2023-05-23 18:42:26 -04:00
parent 981fd62470
commit 883fb01995
3 changed files with 9 additions and 0 deletions

BIN
src/scratchpad/for_seqs Executable file

Binary file not shown.

View File

@ -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)

View File

@ -1 +1,2 @@
echo @[ "1", "2" ] in @["1", "2", "3" ]
# ^ does not work.