flang.dev — The Fuzion Language Portal
JavaScript seems to be disabled. Functionality is limited.
Fuzion
•
Idioms
•
Idiom # 224: Add element to the beginning of the list
Idiom # 224: Add element to the beginning of the list
See
programming-idioms.org
:
Code
# using 'infix ++' items := [x] ++ items # using 'insert' items := items.insert 0 x
What are effects?
Running Example
ex224 is items := [0,1,2,3,4,5,6,7,8,9] x := 99 items := [x] ++ items say items items := items.insert 0 x say items
What are effects?
next: Idiom # 225: Declare and use an optional argument