Created
April 22, 2018 17:52
-
-
Save CodeDoes/8d071ade52c431d14327d21f4cb5f5f7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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