Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Storing a logical condition

From: gedb01:yah:oo at: 13-Oct-2003 21:45

Hi Tim, --- Tim Johnson <[tim--johnsons-web--com]> wrote: >
> Hello rebols: > I'd like to store a logical condition in a block to > evaluate at a later time by 'if or 'either > Example code: > >> a: 1 > == 1 > >> b: [a = 0] > == [a = 0] > >> either b[print "b evaluates to 'true'"][print "b > evaluates to 'false'"] > b evaluates to 'true' > > What do I need to do so that my answer will be: > b evaluates to 'false' > > thanks > tim
All you have to do now is 'do b':
>> a: 1
== 1
>> b: [a = 0]
== [a = 0]
>> do b
== false
>> a: 0
== 0
>> do b
== true You can use it in conditionals like this:
>> either do b [print "A is zero"][print ["A is " a]]
A is zero
>> a: 42
== 42