In message <[EMAIL PROTECTED]>, [EMAIL PROTECTED] writes
>
>In a message dated 23/04/2008 19:59:57 GMT Daylight Time,
>[EMAIL PROTECTED] writes:
>
>Are you  sure that every "IF" statement has an "END IF" ?
>
>Particularly when  nested loops and conditions are coded
>
>
>Hi Malcolm,
>I am fairly sure that they do it is one of the first things I looked  for.
>
>Duncan

Hi Duncan,

Now that I have seen the coding extract, I can see that you do have a 
matching "IF" and "END IF".

However, you also have a "FOR" loop within the "IF" statement as a 
whole, so this could be where the error is being thrown up.

I do my "FOR" loops like this ( the long way )

FOR num%=1 TO 6
     READ an_option$(num%)
END FOR num%

Which is what you have done too.

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

Although you may be better using the "EXIT i", rather than as "END FOR 
i"

I also always use integers for loops with Turbo, so "i%" rather than 
just "i"

I use "REPeat" and "END REPeat" conditions as the main condition mode, 
which allows any number of "IF" and "END IF" conditions to be set up as 
well inside that.

Always use "EXIT" from a REPeat.

Which may achieve what you are intending to do much better, and allows 
for elegant looking coding.

In addition I find that the "SELect ON num%" and "END SELect" again 
gives an elegant listing with endless options from the value of the 
variable.

Another thing to do is to make any variables "LOCal" to a PROCedure, 
which avoids confusion when using "i" or "i%".

I hope this helps.

-- 
Malcolm Cadman
_______________________________________________
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm

Reply via email to