insertFirst
Last updated
Last updated
Inserts an element to the front of a list.
data
The list to be updated.
List
-
-
Yes
value
The element to be added to the list.
Any
-
-
Yes
Returns the updated list.
List
In this example, we will insert a value in the first index of a list and print the result in the console.
Call the function List.insertFirst
inside the Log.write
function
Then call the function Conversion.toList
inside the List.insertFirst
function.
The console will print [1,3,1,5]
.
See also:
Functions