fuzion-lang.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 items0 := [0,1,2,3] x := 99 items1 := [x] ++ items0 say items1 items2 := items1.insert 0 x say items2
What are effects?
last changed: 2024-07-01
next: Idiom # 225: Declare and use an optional argument