Just curious, do you mean something like this?
proc mycount(a, b: int): iterator (): int =
result = iterator (): int =
var x = a
while x <= b:
yield x
inc x
(Example taken from [https://nim-lang.org/docs/manual.html#iterators-and-the-for-statement](https://nim-lang.org/docs/manual.html#iterators-and-the-for-statement))
