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

9 lines
162 B
Nim
Raw Normal View History

2023-05-23 22:59:54 +00:00
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")