Let enum be iterable #12472
smartiniOnGitHub
started this conversation in
Ideas
Replies: 1 comment 2 replies
-
I just missed that feature, converting a program of mine from Odin to V. I've searched the docs but it seems there's no way to iterate an |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi all,
what do you think to be able to iterate across all enum values ? Maybe generated at compile time only when needed.
It would be useful to loop in a simple way with bounded values etc ...
If possible maybe with the ability to know current item index (like in other for loops) and even: numeric value (from enum value), string value (from enum string key).
Or if simpler, a function (a compile time facility ?) to return an array with those values, and use it as iterable in for loops etc ...
I think it could be related/an expansion of what proposed in:
#11646
Hope you like this proposal.
Thanks. Regards
Beta Was this translation helpful? Give feedback.
All reactions