t14153.nim 285 B

1234567891011121314151617181920212223
  1. discard """
  2. output: '''
  3. index 5 not in 0 .. 2
  4. index 5 not in 0 .. 2
  5. '''
  6. """
  7. var x = @[1, 2, 3]
  8. try:
  9. echo x[5]
  10. except IndexError:
  11. echo getCurrentExceptionMsg()
  12. except:
  13. doAssert false
  14. try:
  15. x[5] = 8
  16. except IndexError:
  17. echo getCurrentExceptionMsg()
  18. except:
  19. doAssert false