Advertisement
Guest User

Error: cannot evaluate at compile time: col

a guest
Mar 5th, 2015
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Nim 0.39 KB | None | 0 0
  1. # Using the col constant breaks the compilation.
  2. var a = @[("asdf", 1323.3434), ("bleh", 123.456), ("meh", -32444.232)]
  3. let col = 1 # column I want
  4. var r = @[a[0][col]]
  5. for i in 1..len(a)-1:
  6.   r.add(a[i][col])
  7. echo(r)
  8.  
  9. # but hardcoding it works:
  10. var a = @[("asdf", 1323.3434), ("bleh", 123.456), ("meh", -32444.232)]
  11. var r = @[a[0][1]]
  12. for i in 1..len(a)-1:
  13.   r.add(a[i][1])
  14. echo(r)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement