[REBOL] Re: Personal Programming and Rebol Promotion
From: Izkata:Comcast at: 23-Dec-2007 3:04
On Sun, 2007-12-23 at 16:37 +0800, Peter Wood wrote:
> Hi Nick
>
> > Just tonight, a reader from my site wrote to say that in the past, all
> > the documentation he had previously read had led him to misunderstood
> > the syntax of a simple 'if expression, originally thinking that the
> > conditional evaluation needed to be placed in brackets (which made
> > every condition always evaluate to true...).
>
> I must be missing something:
>
> >> (1 = 2)
> == false
> >> (1 = 1)
> == true
> >> ("a" = "a")
> == true
> >> ("a" > "c")
> == false
Brackets, not parens:
>> to-logic [1 = 2]
== true
And I can see one reason why this would be especially confusing - 'if
versus 'while. They both have conditionals, except 'while does use a
block while 'if does not. This makes sense because the condition in an
'if is only evaluated once, while 'while needs to evaluate the condition
multiple times, but the reasoning is only apparent once you understand
how a block! works.