Hi Paul

The example you give executes correctly and returns 999. Here's why. The ANY
function evaluates the sub-expressions in it's block argument and returns
when it encounters the first expression which does not yield FALSE or NONE.
In the example FIND data 432 returns NONE. This fails the criteria so ANY
evaluates the next expression 999. This does not yield NONE or FALSE, so the
value of this expression is returned from ANY. The expressions in the ANY
block can also be REBOL code.

>> data: [123 456 789]
== [123 456 789]

>> print any [find data 432 999]
999

>> find data 432
== none

>> any [999]
== 999

>> if 999 [print true]
true

>> any[ find data 432 print "hello"]
hello

 Hope this helps

Larry

BTW Some folks on the mailing list would probably appreciate it if you
turned off HTML in your posts.


----- Original Message -----
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, January 27, 2000 7:38 PM
Subject: [REBOL] Find Function


The following user guide doc - expcondition.html - contains a section called
Conditional Evaluation where it discusses the use of the any and all
functions.  In one of the examples I am having difficulting understanding
the example as given:



You can use it with functions like find to always return a valid result:
data: [123 456 789]
print any [find data 432 999]
999



Can somone explain this.  It may be incorrect but it seems the find function
is not going to return any value of "data:".

I thought maybe this was an error in the documentation.

Paul Tretter
Paul's Rebol Page http://24.217.20.110/rebolsearch/rebol.htm


Reply via email to