Quick Question - Dec Command

Rauwomos

New Member
Hi

I'm just wondering if I use the dec command on a variable which is already 0, will it screw up my program
Code:
let b1 = 0
if pinb.2 = 1 then
    dec b1
endif
if b1 = 0 then goto main
Thanks
 

Buzby

Senior Member
DEC will roll-under to either 255 ( for byte variables ) or 65535 ( for word variables )

It's hard to tell what it will do to your program, we can't see it from here !

Try it in the simulator.

Cheers,

Buzby
 

SAborn

Senior Member
The easy solution would be ........

if pinb.2 = 1 and b1 > 1 then
dec b1

......................................
 
Top