Hello [EMAIL PROTECTED]!
On 10-Gen-00, you wrote:
a> Can someone please explain why the first result is word
a> instead of logic, and why the second prints anything at all?
a>>> b: ["John" true "Sam" false]
a> == ["John" true "Sam" false]
a>>> print type? second b
a> word
a>>> if fourth b [print "OK"]
a> OK
Because REBOL is a language without keywords. true and false are
simply words, whose values are the two logic values `true' and
`false'. Once you have evaluated the words, you get the logic
values:
>> block: reduce ["John" true "Sam" false]
== ["John" true "Sam" false]
>> type? block/2
== logic!
>> type? block/4
== logic!
>> if block/4 [print "It's true"]
== false
As for your second question, if evaluates the block of code every
time its first argument (the condition) is different from the
values false or none --- so if the condition is a word, the code
is executed.
Regards,
Gabriele.
--
o--------------------) .-^-. (----------------------------------o
| Gabriele Santilli / /_/_\_\ \ Amiga Group Italia --- L'Aquila |
| GIESSE on IRC \ \-\_/-/ / http://www.amyresource.it/AGI/ |
o--------------------) `-v-' (----------------------------------o