Hi, David...

[EMAIL PROTECTED] wrote:
> 
> Can someone please explain why the first result is word instead
> of logic...
> 
> >> b: ["John" true "Sam" false]
> == ["John" true "Sam" false]
> >> print type? second b
> word

Because 'true and 'false are not literal logic values, but rather are
simply words predefined to refer to logic values (fortunately, the
ones you would expect ;-).  The words 'yes and 'no, as well as
'on and 'off, are likewise predefined.

For more details, see the values/logic section of the new manual, at:

    http://www.rebol.com/manual/vallogic.html

> 
> and why the second prints anything at all?
> 
> >> if fourth b [print "OK"]
> OK
> 

The convention is that if an expression evaluates to 'none, then it
is treated as false; otherwise it is treated as true.  The fourth
element of the block referenced by 'b exists, and is a word.
Therefore it behaves as if true.

SUGGESTION:

To get what you seem to be looking for, try 'do on the word/value
that you pull from the block.

    >> c: [true false on off yes no]
    == [true false on off yes no]
    >> foreach thingy c [
    [    print [thingy "^-" to-logic thingy "^-" do thingy]
    [    ]
    true     true    true
    false    true    false
    on   true    true
    off      true    false
    yes      true    true
    no   true    false

-jn-

Reply via email to