-
Notifications
You must be signed in to change notification settings - Fork 1
DoPop
ricardoboss edited this page Sep 13, 2023
·
1 revision
doPop
removes the last element from a list and returns it.
doPop(list myList)
-
myList
is the list to pop from
-
doPop
is a mutating function, so it modifies the list given to it - if the list is empty,
doPop
returnsnull
-
doPop
is the opposite ofdoAdd
list l = [1, 2, 3]
doPop(l) // returns 3
println(l) // prints [1, 2]
doPop(l) // returns 2
println(l) // prints [1]
doPop(l) // returns 1
println(l) // prints []
doPop(l) // returns null
© 2023 Ricardo Boss • Licensed under MIT • Want to update this page? Edit it on GitHub and submit a pull request!