'For next loop demonstration 'Just some work variables x var byte y var word 'It all starts here main 'Count from 1 to 5 debug ["1 to 5 : Display 1 2 3 4 5",13] for x = 1 to 5 debug [dec x," "] next debug [13,13] 'Count down from 5 to 0 debug ["5 to 0 step -1 : Display 5 4 3 2 1 0",13] for x = 5 to 0 step -1 debug [dec x," "] next debug [13,13] 'Count from 10 to 50 by tens debug ["10 to 50 step 10 : Display 10 20 30 40 50",13] for y = 10 to 50 step 10 debug [dec y," "] next debug [13,13] 'Count from 100 to 500 by hundreds debug ["100 to 500 step 100 : Display 100 200 300 400 500 ",13] for y = 100 to 500 step 100 debug [dec y," "] next debug [13,13] 'Count down from 5000 to 1000 by thousands debug ["5000 to 1000 step -1000 : Display 5000 4000 3000 2000 1000 ",13] for y = 5000 to 1000 step -1000 debug [dec y," "] next debug [13,13] 'Some exceptions 'Nothing in this for loop will be executed for x = 1 to 0 debug [dec y," "] next debug [13,13] 'Wait 5 seconds then go back and do it all again pause 5000 goto main end