Re: How Come This Binary Op Doesn't Work?
c.k.lester wrote:
>
> }}}
<eucode>sequence temp
> integer bool
>
> temp = {}
>
> bool = atom(temp) and temp = 1</eucode>
{{{
>
> bool keeps getting set to an empty sequence, not 0.
>
> What's up with that?!?!
I was testing this. What's happening is the interpreter sees "temp = 1" as a
sequence operation.
If you set temp to {1, 0, 1} and then print temp = 1 you get {1, 0, 1}. See what
I'm saying?
See http://www.rapideuphoria.com/refman_2.htm#26
Plus, short-circuiting only works in if and while statements. Another reason for
that not to work.
You're gonna have to wrap your expression in an if statement.
--
"Any programming problem can be solved by adding a level of indirection."
--anonymous
"Any performance problem can be solved by removing a level of indirection."
--M. Haertel
"Premature optimization is the root of all evil in programming."
--C.A.R. Hoare
j.
|
Not Categorized, Please Help
|
|