fuzion-lang.dev — The Fuzion Language Portal
JavaScript seems to be disabled. Functionality is limited.
Fuzion
•
Idioms
•
Idiom # 6: Iterate over list values
Idiom # 6: Iterate over list values
See
programming-idioms.org
:
Code
Code input
# using a loop for x in items do something x # using for_each and a lambda items.for_each something # using map and a lambda items.map something
What are effects?
Running Example
To create instances, use this code
Code input
ex6 => items := ["red", "yellow", "green", "pink"] something(x String) => say "I saw $x elephants" # using a loop for x in items do something x # using for_each and a lambda items.for_each something # using map and a lambda items.map something # map is lazy! To see side effects, force execution, eg., using fold .fold unit.monoid
What are effects?
last changed: 2025-05-13
next: Idiom # 7: Iterate over list indexes and values