Morning Duncan,

Hopefully I'm remembering my FOR..NEXT..END FOR syntax correctly, but the 
following looks remarkably suspicious :


9472 FOR i=1 TO scrolls
9474 Dev_Scroll_down
9476 IF dv_start<=1 :END FOR i
9478 END FOR i 

I think it should be :

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 :

9476 IF dv_start<=1 THEN EXIT i : END IF

Basically, and if I remember correctly, a For loop looks like this :

FOR variable = start TO finish STEP step
  do stuff
  IF condition THEN EXIT variable : END IF : REM - Early exit 
  IF other_condition THEN NEXT variable: END IF : REM - Reloop early
  do other stuff
END FOR variable


Cheers,
Norman.
_______________________________________________
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm

Reply via email to