christianparpart/flow

iterators and iterator based for loops

Opened this issue · 0 comments

implement iterator based for loops

code example

def range(int n) : iterator<int> {
  var i = 0;
  while i < n {
    yield i;
    i = i + 1;
  }
}

main {
  for n in range(5) {
    print(string(n));
  }
}
# prints 5 lines with the numbers 0 to 4.