Guest User

Untitled

a guest
Jun 29th, 2016
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. type IntLikeForCount = int|int8|int16|int32|char|bool|uint8|uint16|enum
  2.  
  3.  
  4. iterator countupn*[S, T](a: S, b: T, step = 1): T {.inline.} =
  5. when T is IntLikeForCount:
  6. var res = int(a)
  7. while res <= int(b):
  8. yield T(res)
  9. inc(res)
  10. else:
  11. var res: T = T(a)
  12. while res <= b:
  13. yield res
  14. inc(res)
  15.  
  16. converter fToi(x:float):int = x.int
  17.  
  18. #var t:int = 4.3
  19.  
  20. for _ in countupn( 1 , 4.3 ):
  21. echo "Test"
Advertisement
Add Comment
Please, Sign In to add comment