I did not know this, but it has been
sitting in front of my face forever. You can evaluate codeblocks within
codeblocks. This is handy when you are building a mechanism
to filter records, which typically consists of a long logical AND
statement, but you need to insert an OR condition. Metacode
example: DATE < today .AND. SALE="GOOD" .AND. (STATE = "TX" OR
"CA").
I am processing the records by
evaluating them against a series of codeblocks, starting with the
most restrictive condition and working my way to the least
restrictive condition. As soon as a record fails a test, I
discard it and go onto the next record. I put the individual
filter conditions into codeblocks and stuff the codeblocks into an
array, so that:
for n := 1 to len( aEval )
if
.not. eval( aEval[n] )
exit
endif
next
if n > len(
aEval )
// this
record is a keeper
What I finally realized is that this is
a valid codeblock:
bOrBlock := {|| eval(bBlock1) .or.
eval(bBlock2)}
This is the way to insert a
logical OR test. The scales have fallen from my eyes.