@jibal The error you're receiving is because you've named the loop variable the 
same as the injected variable, which overrides the injected variable. This 
works:
    
    
    template t(body: untyped) =
      proc bod(a: int) =
        let x {.inject.} = a
        body
      
      for i in [1, 2, 3, 4]:
        bod(i)
    
    t:
      echo x
    
    
    Run

Reply via email to