compute-constrained-bayes/src/scratchpad/findIndex.nim

9 lines
162 B
Nim

proc findIndex(xs: seq[string], y: string): int =
for i, x in xs:
if x == y:
return i
return -1
let xs = @["a", "b", "c"]
echo findIndex(xs, "a")