[REBOL] Re: ? takes a 'word argument
From: arolls::bigpond::net::au at: 11-Jan-2001 13:03
Check out the func header below.
>> source ?
?: func [
"Prints information about words and values."
'word [any-type!]
/local value args item name refmode types attrs rtype
][ ... ]
Notice the word argument is preceded by a single quote.
The single quote specifies that the supplied argument is
not evaluated. It is treated as a literal word.
So if you type
>> ? blabla
the value of word is 'blabla. ie. the literal word "blabla".
See the rest of source ? to see how 'word is referred to in code.
:word means get the value of the lit-word (ie. evaluate it).
Play around with : ' get and set...
see: func ['a1 [any-type!]][
if value? 'a1 [
print ["a1 =" a1 "=" if value? :a1 [get :a1]]
]
]
>> a: 2
== 2
>> see a
a1 = a = 2
>> b: 45
== 45
>> see b
a1 = b = 45
>> see z
a1 = z = none
Anton.