Re: How to tell the difference bewteen comparing and assigning

new topic     » goto parent     » topic index » view thread      » older message » newer message

Also, a comparison can be used inside a statement.

Ie. ... x = 3 + a*(y = 0)
x is
a+3 for y = 0
3 for all other values of y

Just check to see whether there are brackets enclosing the = sign.... for an 
assignment, there shouldn't be.

Just remember to look for 'or', 'and' and 'then' as well as what you put 
below, and you should be right.

Summary:

For comparison '='

if*=*then

if*=*or
...
or*=*then
and*=*then
not*=*then

while*=*do

(*=*)

IF and WHILE must be at the beginning, THEN and DO must be at the end, OR 
NOT AND can be either.

With the brackets, it's a little more difficult, because a comparison '=' 
could be hidden inside a larger one.... ie

x = 4*( z = (4*b+c))
ie x = 4 if z = 4b + c,
or x = 0 otherwise.

I think that's all bases covered... ask the Creator, if he's in.


-----------------
MrTrick
>From: stabmaster_ at HOTMAIL.COM
>Reply-To: EUforum at topica.com
>To: EUforum <EUforum at topica.com>
>Subject: Re: How to tell the difference bewteen comparing and assigning
>Date: Sun, 12 May 2002 20:33:43 +0000
>
>
>One way to spot comparisons (although it probably doesn't cover _all_
>possible comparisons) are when '=' is used after 'if' or 'while'
>
>if 1=0 then...
>
>while 0=1 do...
>
>etc.
>
>
>
>

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu