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
# using a loop for x in items do something x # using a pipe and a lambda items ! something # using map and a lambda items.map something
What are effects?
Running Example
To create instances, use this code
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 a pipe and a lambda items ! something # using map and a lambda items.map something # map is lazy! To see side effects, force execution, eg., using fold .fold unit.type.monoid
What are effects?
last changed: 2024-07-01
next: Idiom # 7: Iterate over list indexes and values