Hi all, I would like to know how can i change the iterating operator in this 
code. This code snippet is from "Nim by Example"
    
    
    # Give it a different name to avoid conflict
    iterator `...`*[T](a: T, b: T): T =
      var res: T = T(a)
      while res <= b:
        yield res
        inc res
    
    for i in 0...5:
      echo i
    
    
    Run

But i want to change the "..." operator to "To". So i wrote this 
    
    
    # Give it a different name to avoid conflict
    iterator `To`*[T](a: T, b: T): T =
      var res: T = T(a)
      while res <= b:
        yield res
        inc res
    
    for i in 0 To 5:
      echo i
    
    
    Run

But it gave this error message

**Error: attempting to call routine: 'To' found 'in.To(a: T, b: T) [declared in 
/usercode/in.nim(2, 10)]' of kind 'iterator'**

Reply via email to