|
|||||
Copying and clearing shelves | |||||
Prerequisite Concepts |
OmniMark's various keywords simplify numerous complex operations that are performed on shelves.
You can copy the contents of one shelf to another by using the copy
keyword. Note that both of the shelves have to be of the same type, and that the stream being copied to must be able to contain at least as many items as exist on the shelf being copied from.
global stream foo variable initial-size 0 process set new foo to "one" set new foo to "two" set new foo to "three" set new foo to "four" set new foo to "five" process local stream bar variable copy foo to bar repeat over bar output bar || "%n" again
You can remove all the items from a shelf by using the clear
action:
process clear foo
These two actions are combined in the copy-clear
action which moves the contents of one shelf to another by copying the contents of the first shelf to the second, and then clearing the first shelf:
process copy-clear foo to bar
Note that the clear
and copy-clear
actions remove all of the items from the shelf, and in order to put new items on that shelf you have to use the set new
action rather than just the set
action.
Prerequisite Concepts Arrays |
---- |