maxrt101 / ff

Scripting language
MIT License
4 stars 0 forks source link

Loops: `foreach` #7

Open maxrt101 opened 2 years ago

maxrt101 commented 2 years ago

Example:

for x in iterable {
}

For iterable to be used in foreach it must implement __iter__. iterable.__iter__ will return an iterator, which must implement __next__.

Iterators: Probably will be a part of built-in types (e.g. IteratorType, Iterator) Will not be copied in foreach, it will conform to standard copying rules though.