tstringslice.nim 338 B

123456789101112131415161718192021
  1. discard """
  2. output: '''1
  3. 1234
  4. 2
  5. 234
  6. 3
  7. 34
  8. 4
  9. 4'''
  10. """
  11. # bug #794
  12. type TRange = range[0..3]
  13. const str = "123456789"
  14. for i in TRange.low .. TRange.high:
  15. echo str[i] #This works fine
  16. echo str[int(i) .. int(TRange.high)] #So does this
  17. #echo str[i .. TRange.high] #The compiler complains about this