Skip to content

Instantly share code, notes, and snippets.

@CodeDoes
Created April 22, 2018 17:52
Show Gist options
  • Save CodeDoes/8d071ade52c431d14327d21f4cb5f5f7 to your computer and use it in GitHub Desktop.
Save CodeDoes/8d071ade52c431d14327d21f4cb5f5f7 to your computer and use it in GitHub Desktop.
import future
iterator `..`(the_slice:HSlice[int,int],step:int):int=
assert(step>0)
var
a=the_slice.a
b=the_slice.b
step=step
for i in countup(a,b,step):
yield i
if isMainModule:
for i in 1..20..3:
echo i
# 1
# 4
# 7
# 10
# 13
# 16
# 19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment