Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation enhancement for methods of an iter-instance? #315

Open
ozett opened this issue Feb 24, 2023 · 1 comment
Open

Documentation enhancement for methods of an iter-instance? #315

ozett opened this issue Feb 24, 2023 · 1 comment

Comments

@ozett
Copy link

ozett commented Feb 24, 2023

as a noobie i rely on the documentation to understand and use berry language.
the port for the iter-methods (on list-elements). is a little short.

image

could you add wich methods are available and how to use them on iter-instances?

i found some snippets about that here with the for-loop, but would be nice to have it in the wiki.

Therefore, if the return value of the iter method is an instance (instance) type, 
this instance must have a next method and a hasnext method.

what do you think?

@s-hadinger
Copy link
Contributor

I think that the doc is wrong, probably some old implementation.

Actually an iterator is just a function that returns the next value each time you call it and raises a "stop_iteration" exception when there are no more values. You can consider an iterator as a generator function, which is generally implemented as a closure to capture state.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants