Welcome to the Parallax Discussion Forums, sign-up to participate.

vwinter
Posts: **2**

PE Kit lab book v1.2 page 91

if Cog

cogStop(cog~ - 1)

If ~ is on a higher level than - 1 why is - 1 evaluated first?

Reference http://nagasm.org/ASL/Propeller/printedPDF/QuickReference-v15.pdf

if Cog

cogStop(cog~ - 1)

If ~ is on a higher level than - 1 why is - 1 evaluated first?

Reference http://nagasm.org/ASL/Propeller/printedPDF/QuickReference-v15.pdf

## Comments

21,233- is precedence level 6 and is subtract.

The key point here is the "post", as in "after".

So what you have in "cogStop(cog~ - 1)" is:

1) Take the value of cog into some internal temporary value.

2) Set the value of cog to zero.

3) Subtract one from that internal temporary value.

4) Pass the temporary value to cogStop as a parameter.

1,374x~ clears x but returns the old value of x. Just like how x++ increments x but returns the old value of x (while ++x increments x but returns the new value instead of the old).

2