Next: appendnotes() Up: MacAnova Help File Previous: anymissing()   Contents

anytrue()

Usage:
anytrue(arg1,arg2,...,argM), all arguments LOGICAL scalars



Keywords: logical variables, syntax
anytrue(a1,a2,...,aM) is equivalent to a1 || a2 || ... || aM, except
that no arguments are evaluated unnecessarily, that is, it evaluates no
arguments after the first true one.  All arguments must be LOGICAL
scalars.

Example:
   if(anytrue(!isscalar(x,real:T),x <= 0, x != floor(x))){
      error("x is not positive integer")
   }

The apparently more natural way to do the same thing
   if(!isscalar(x,real:T) || x <= 0 || x != floor(x)){
      error("x is not positive integer")
   }
would not do what you want for a non-REAL x since an attempt would be
made to evaluate floor(x), which is illegal for non-REALs.

See also topics 'logic', alltrue()


Gary Oehlert 2003-01-15