tweak: iteration over element and index in scratchpad.
This commit is contained in:
parent
981fd62470
commit
883fb01995
BIN
src/scratchpad/for_seqs
Executable file
BIN
src/scratchpad/for_seqs
Executable file
Binary file not shown.
8
src/scratchpad/for_seqs.nim
Normal file
8
src/scratchpad/for_seqs.nim
Normal 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)
|
|
@ -1 +1,2 @@
|
|||
echo @[ "1", "2" ] in @["1", "2", "3" ]
|
||||
# ^ does not work.
|
||||
|
|
Loading…
Reference in New Issue
Block a user