for...next loop

jonny foster

New Member
Hello, im using a for next loop and im trying to use the exit command to terminate the loop early. I expected after the exit command was used it would jump to the line after the for next loop, but it seems to jump right back to the start! Here's the code:

label_1:
let w6 = w6 + 10
let outpins = %00000000
for b27 = 0 to 40 STEP 2
get b27, word w7 if w7 = 0 then exit
next b27
high 1
put b27, word w6
goto eoc


eoc:

Since w7 does = 0, I was expecting it to jump to "high 1" after the loop but it jumps all the way back to label_1 when i simulate it in the programming editor :s, might be being an idiot here, sorry if thats the case :), thanks for any help anyway.
 

eclectic

Moderator
This little program
Code:
#picaxe 18X
sertxd ("Starting ,...............................")

main:
for b0 = 0 to 100
sertxd (#b0,cr,lf)
pause 100
if b0 = 50 then exit

next

sertxd ("Made an exit :-)",cr,lf)
also re-starts, in simulation,
but works on a real chip

e
 

Attachments

Technical

Technical Support
Staff member
Real chip will be fine, also the simulation will work when you upgrade to the current release version (5.2.9) which fixes this known simulation bug with exit
 
Top