Dilwyn Jones wrote: >> 9472 FOR i=1 TO scrolls >> 9474 Dev_Scroll_down >> 9476 IF dv_start<=1 TEHN NEXT i : END IF >> 9478 END FOR i >> >> I can't remember off hand if Turbo is happy with no end ifs on a >> single line IF, so I've always put them in myself, even in >> SuperBaisc interpreted programs. >> >> I also assume that if DV_STARTS is 1 or less that you want to go >> around the loop again and not exit from the loop itself. If you did >> want to bale out early, then line 9467 would change to : >> > In my programs I tend to put a catch-all in for cases like this which > allows this case to go around the loop again, but also to exit the > loop if exhausted: > > 9476 IF dv_start <= 1 THEN NEXT i : EXIT i > > The exit gets ignored unless the loop is exhausted. Not sure if it's > good programming style, but it does seem to work. > > Actually Dilwyn uses the correct style here:
Try: 10 FOR i=1 TO 9 20 PRINT i;" "; 30 IF i MOD 2 THEN NEXT i 40 PRINT i^2 50 END FOR i Output is: 1 2 43 4 165 6 367 8 649 81 The NEXT is ignored when i=9 It is fixed with 30 IF i MOD 2 THEN NEXT i: EXIT i -- Rich Mellor RWAP Services URL:http://www.rwapsoftware.co.uk URL:http://www.rwapservices.co.uk _______________________________________________ QL-Users Mailing List http://www.q-v-d.demon.co.uk/smsqe.htm
