Skip to content

Instantly share code, notes, and snippets.

@bucho666
Created October 4, 2019 07:26
Show Gist options
  • Save bucho666/a7344c3cff5892015ff2bf90a38fe698 to your computer and use it in GitHub Desktop.
Save bucho666/a7344c3cff5892015ff2bf90a38fe698 to your computer and use it in GitHub Desktop.
itemsイテレータで直接イテレートできる
type Range = ref object of RootObj
min: int
max: int
iterator items(r: Range): int =
for n in r.min..r.max:
yield n
proc iterator_obj() =
for n in Range(min:3, max:12):
echo n
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment