%% /lifo public
new-lifo mylist
// Add data to the list
write-lifo mylist key "key1" value "value1"
write-lifo mylist key "some2" value "other2"
start-loop
// Get data from the list
read-lifo mylist key k value v status st
// Check if no more data
if-true st not-equal GG_OKAY
break-loop
end-if
@Obtained key <<print-out k>> with value <<print-out v>>
end-loop
// Go through the list again, use rewind-lifo for that
rewind-lifo mylist
start-loop
read-lifo mylist key k value v status st
if-true st not-equal GG_OKAY
break-loop
end-if
@Again obtained key <<print-out k>> with value <<print-out v>>
end-loop
// Delete all in LIFO
purge-lifo mylist
// Verify nothing is left
rewind-lifo mylist
read-lifo mylist key k value v status st
if-true st not-equal GG_OKAY
@LIFO is empty
end-if
%%
Copied!