RosettaCodeData/Task/Singly-linked-list-Element-insertion/OoRexx/singly-linked-list-element-insertion.rexx
2023-07-01 13:44:08 -04:00

19 lines
407 B
Rexx

list = .list~new
index = list~insert("abc") -- insert a first item, keeping the index
Call show
list~insert("def") -- adds to the end
Call show
list~insert("123", .nil) -- adds to the begining
Call show
list~insert("456", index) -- inserts between "abc" and "def"
Call show
list~remove(index) -- removes "abc"
Call show
exit
show:
s=''
Do x over list
s=s x
end
say s
Return