fuzion-lang.dev — The Fuzion Language Portal
JavaScript seems to be disabled. Functionality is limited.
Fuzion
•
Idioms
•
Idiom # 44: Insert element in list
Idiom # 44: Insert element in list
See
programming-idioms.org
:
Code
s := s.take i ++ [x] ++ s.drop i
What are effects?
Running Example
ex44 is a := [0,1,2,3,4,5,6] x := 999 for i in -2..10 do s := a.take i ++ [x] ++ a.drop i say "inserting at $i results in $s"
What are effects?
last changed: 2024-07-01
next: Idiom # 45: Pause execution for 5 seconds