While this section is up-to-date and complete, it has to be reformated to be easier on the eyes. All UPPERCASE statement names and code should be changed to lowercase.
PUSH _ TO _
PUSH - TO statement is used to add elements to a LIST. When you push an element to a LIST it is appended at the end of the list.
PUSH <NUMBER-VAR or NUMBER> TO <NUMBER-LIST> PUSH <TEXT-VAR or TEXT> TO <TEXT-LIST>
1 2 3 4 5
DATA: foo IS TEXT LIST PROCEDURE: PUSH "First index" TO foo PUSH "Second index" TO foo
In the above example,
foo now contains the value
"First index" at index
0 and the value
"Second index" at index
CLEAR statement empties a LIST, thus deleting all its contents. The LIST itself is not deleted though, and can still be used and filled with new elements after a
CLEAR statement has been executed.
COPY _ TO _
COPY - TO statement copies all the elements of a LIST with their respective indices to another LIST of the same type. The original LIST is untouched, but the destination LIST is completely overwritten by the contents of the copied LIST and any elements that existed in it prior to the copy are deleted. In other words, the destination LIST is
CLEARed before the copy.
COPY <TEXT-LIST> TO <TEXT-LIST> COPY <NUMBER-LIST> TO <NUMBER-LIST>
1 2 3 4 5 6 7 8 9
DATA: foo IS TEXT LIST bar IS TEXT LIST PROCEDURE: PUSH "Hello there!" TO foo PUSH "How are you?" TO foo COPY foo TO bar DISPLAY bar:0 " " bar:1 CRLF # Will display "Hello there! How are you?"
GET LENGTH OF _ IN _
GET LENGTH OF - IN statement stores the amount of elements stored in a LIST (or, analogously, the length of the LIST) into a numeric variable.
GET LENGTH OF <LIST> IN <NUMBER-VAR>
1 2 3 4 5 6 7 8 9
DATA: foo IS TEXT LIST count IS NUMBER PROCEDURE: PUSH "Hello there!" TO foo PUSH "How are you?" TO foo STORE LENGTH OF foo IN count DISPLAY count CRLF # Will display 2
DELETE LAST ELEMENT OF _
DELETE LAST ELEMENT OF deletes the last element pushed to a LIST. If the LIST was empty, this statement does nothing.
DELETE LAST ELEMENT OF <LIST>