[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: assignment inside boolean expression




Ben Tupper <tupper@seadas.bigelow.org> writes:
> "Liam E.Gumley" wrote:
> 
> >
> > Recall that in IDL, integers with odd non-zero values are Boolean
> > 'True'. Beware of floats and doubles though, where any non-zero value is
> > Boolean 'True'.
> >
> 
> Dang!
> 
> I just spent an hour figuring out an efficient way of determining if an
> integer is odd!
> 
> I have an IDL function ISODD() for sale... very cheap.   No reasonable
> offer refused.

Not to undercut you, but will (X AND 1) do the trick?

Craig


-- 
--------------------------------------------------------------------------
Craig B. Markwardt, Ph.D.         EMAIL:    craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
--------------------------------------------------------------------------