REBOL 3 Docs | Guide | Concepts | Functions | Datatypes | Errors |
TOC < Back Next > | Updated: 3-Aug-2010 Edit History |
Sets a word, path, block of words, or object to specified value(s).
Arguments:
word [any-word! any-path! block! object!] - Word, block of words, path, or object to be set
value [any-type!] - Value or block of values
Refinements:
/any - Allows setting words to any value, including unset
/pad - For objects, if block is too short, remaining words are set to NONE
See also:
If the first argument is a block of words and the value is not a block, all of the words in the block will be set to the specified value. If the value is a block, then each of the words in the first block will be set to the respective values in the second block. If there are not enough values in the second block, the remaining words will be set to NONE
The /ANY refinement allows words to be set any datatype including those such as UNSET! that are not normally allowed. This is useful in situations where all values must be handled.
set 'test 1234
print test
1234
set [a b] 123
print a
123
print b
123
set [d e] [1 2]
print d
1
print e
2
You can also use set-word! within the set function:
set [a: b:] [1 2]
This is useful if you use the funct function, which auto-detects local variables that use the set-word notation.
TOC < Back Next > | REBOL.com - WIP Wiki | Feedback Admin |