tprevent_forloopvar_mutations.nim 305 B

12345678910111213141516
  1. discard """
  2. errmsg: "type mismatch: got <int>"
  3. line: 15
  4. nimout: '''type mismatch: got <int>
  5. but expected one of:
  6. proc inc[T: Ordinal | uint | uint64](x: var T; y = 1)
  7. for a 'var' type a variable needs to be passed, but 'i' is immutable
  8. expression: inc i
  9. '''
  10. """
  11. for i in 0..10:
  12. echo i
  13. inc i