|
|||||
action | set new | ||||
Sample Code | Related Syntax |
Syntax
set new shelf-type? shelf-name (^ string-expression)? insertion-point? to (numeric-expression | string-expression | test-expression)
The set new
action is, essentially, a composition of the set
and the new
actions. It simply replaces the shelf-name part of a set
action with an entire new
action.
The set new
action first performs the embedded new
action, and then sets the value of the inserted item of the expression after the keyword to
.
The type of expression appearing after the keyword to
depends on the shelf type:
The insertion-point is identified using the keywords before
or after
.
The following program creates a variable stream shelf, then sets the first value on that shelf. A series of three set new
actions is used to create and set the values of new items on that shelf:
global stream quotes variable process set quotes to "Is this a dagger?" set new quotes to "To be or not to be?" set new quotes before item 2 to "A horse!" set new quotes after item 1 to "What light?" repeat over quotes output quotes || "%n" again
The output of this program is:
Is this a dagger? What light? A horse! To be or not to be?
Sample Code
Binding shelf instances with "using" |
Related Syntax new, set new set |
---- |