Range Over Iterators in Squirrel
We define the push
method to add elements to our List.
All returns an iterator, which in Python is a function with a special signature.
The iterator function takes another function as a parameter, and we can use the yield
keyword to return each element.
Here’s how to use it in a regular loop.
Output:
Next example: Errors.