[Squeakland] Using binary conditions as a part of a Test Box

Scott Wallace scott.wallace at squeakland.org
Fri Oct 27 04:08:46 PDT 2006


Hi, Offray!

For the present, one has to use *nested* Test Boxes to achieve the  
effect of the "ands" and "ors" you want.

Thus, where you want, for example

   TEST ((elmer's x < 5) and (elmer's y < 5))
          YES  elmer make sound croak

this could be constructed as:

TEST  elmer's x < 5
   YES   TEST elmer's y < 5
            YES   elmer make sound croak

or (to explicate my shorthand):

-------------- next part --------------
A non-text attachment was scrubbed...
Name: pastedGraphic.tiff
Type: image/tiff
Size: 198714 bytes
Desc: not available
Url : http://squeakland.org/pipermail/squeakland/attachments/20061027/4cd566c0/pastedGraphic-0001.tiff
-------------- next part --------------


or, if you wanted code in the NO branch as well,

TEST (a and b)
   YES  <some action>
   NO   <some other action>

would be achieved by:

TEST a
   YES  TEST b
          YES  <some action>
          NO  <some other action>
   NO  <some other action>

and similarly for the (non-exclusive) OR,

TEST  (a or b)
   YES  <some action>

would translate into:

TEST   a
   YES  <some action>
   NO   TEST b
          YES  <some action>

etc.


Cheers,

   -- Scott


On Oct 26, 2006, at 3:28 PM, Offray Vladimir Luna C?rdenas wrote:

> Hi all,
>
> There is a way to put two condition as a part of a Test Box in a Etoys
> script. We can add more operant to a condition, but all the operators
> are aritmetic ones: "+", "-", "*", "//", and "\\" but there is a  
> way to
> create a Test condition with "and" or "or"?
>
> I don't know if I made myself clear enough.
>
>
> Cheers,
>
> Offray
> _______________________________________________
> Squeakland mailing list
> Squeakland at squeakland.org
> http://squeakland.org/mailman/listinfo/squeakland



More information about the Squeakland mailing list