> >>#(true and 4*5)# returns 20.
> >>#(false and 4*5)# returns false.
> >>#(4*5 and false)# returns false.
> >>#(4*5 and true)# returns true.
> >>
> >>Is it a bug or it is using some sort of _expression_ evaluation that I am
>not
> >>aware of.
> >>
> >
> >CF uses short-circuit boolean evaluation. So it'll either stop the moment
>it
> >hits a false condition or it'll go to completion. Further, any non-zero
> >value evaluates to true, so 4*5 (20) will always evaluate to true.
>
>So you are saying the answer is true??? Is that what you are saying? The
>answer is 20.
>
No, I'm saying that because of the way short-circuit boolean evaluation
works, it'll return the last value evaluated in the _expression_. So, for the
first example, since 4*5 is the last _expression_, and 20 is the same as true
(a non-zero value), it returns 20. If you want to be explicit about what
gets returned, then you could put yesNoFormat() around the _expression_:
#yesNoFormat((true and 4*5))#
The above returns "Yes".
Regards,
Dave.
[Todays Threads]
[This Message]
[Subscription]
[Fast Unsubscribe]
[User Settings]
- RE: Is it a bug or not a bug? Mark W. Breneman
- Re: Is it a bug or not a bug? Bryan F. Hogan
- Re: Is it a bug or not a bug? Johnny Le
- Re: Is it a bug or not a bug? Johnny Le
- Re: Is it a bug or not a bug? Johnny Le
- Re: Is it a bug or not a bug? Ben Doom
- Re: Is it a bug or not a bug? Claude Schneegans
- Re: Is it a bug or not a bug? Ben Doom
- RE: Is it a bug or not a bug? Douglas.Knudsen
- RE: Is it a bug or not a bug? Dave Carabetta
- Re: Is it a bug or not a bug? Dave Carabetta
- Re: Is it a bug or not a bug? Claude Schneegans
- RE: Is it a bug or not a bug? Mark W. Breneman
- Re: Is it a bug or not a bug? Claude Schneegans
- Re: Is it a bug or not a bug? Dave Carabetta
- Re: Is it a bug or not a bug? Bryan F. Hogan
- RE: Is it a bug or not a bug? Barney Boisvert
- Re: Is it a bug or not a bug? Bryan F. Hogan
- RE: Is it a bug or not a bug? Barney Boisvert
- Re: Is it a bug or not a bug? Claude Schneegans
- RE: Is it a bug or not a bug? Barney Boisvert