Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

That's nearly identical to Python's approach, too. It doesn't have C-style loops, just ones that consumer iterators.

  for i in range(10):
      print(i)
consumes 1 value at a time from the `range(10)` generator. `for` has no special knowledge of numbers or ranges or any of that.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: