Author |
Topic: REPEAT loops indentation (Read 896 times) |
|
rtr2
Guest
|
 |
Re: REPEAT loops indentation
« Reply #1 on: Nov 1st, 2014, 4:05pm » |
|
on Nov 1st, 2014, 2:15pm, chrispc wrote:| Why in the first version are the two outside loops not indented |
|
If the indentation isn't correct when you list the routine in the context of the entire program, then evidently there is a fault earlier on in the code. Try running the Cross Reference utility (slot 5 in the menu, usually) to see if that reports anything untoward.
You prefixed your remarks by saying that you use the indentation to check the correctness of your code, and indeed the faulty indentation is demonstrating that something in your code isn't correct!
Richard.
Quote:| P.S. After writing the above, and then checking the version your website shows, I see that it left-justified my text, |
|
That's because you omitted the code tags. With them, whitespace is preserved and it appears as follows:
Code: 7030 DEF PROC_PrintUpdatedGrid
7040 PRINT"Now we shall look at the updated grid, after PROC_Eliminations."
7050 X=0
7060 REPEAT
7070 X=X+1
7080 Y=0
7090 REPEAT
7100 Y=Y+1
7110 Z=0
7120 REPEAT
7130 Z=Z+1
7140
7150 PRINT"N(";X;",";Y;",";Z;") = ";N(X,Y,Z)
7160
7170 UNTIL Z=9
7180 UNTIL Y=9
7190 UNTIL X=9
|
| « Last Edit: Nov 1st, 2014, 4:30pm by rtr2 » |
Logged
|
|
|
|
rtr2
Guest
|
 |
Re: REPEAT loops indentation
« Reply #2 on: Nov 4th, 2014, 10:17pm » |
|
on Nov 1st, 2014, 4:05pm, g4bau wrote:| evidently there is a fault earlier on in the code. Try running the Cross Reference utility |
|
Did that enable you to locate the fault? A possible cause of incorrect indentation is an 'unexpected' (surplus to requirements) ENDIF or ENDWHILE statement. The Cross Reference utility will report that, if present.
Richard.
|
|
Logged
|
|
|
|
chrispc
New Member
member is offline


Posts: 19
|
 |
Re: REPEAT loops indentation
« Reply #3 on: Nov 5th, 2014, 09:18am » |
|
Thanks for your 2nd thought on the indentation. I looked at the Cross Reference and at first thought how great it was, then noticed that it told me that I had an unexpected ENDIF at row 562. Did that mean LINE 562? Because I haven't got one; I go from 560 to 570. What now? chrispc
|
|
Logged
|
|
|
|
rtr2
Guest
|
 |
Re: REPEAT loops indentation
« Reply #4 on: Nov 5th, 2014, 10:40am » |
|
on Nov 5th, 2014, 09:18am, chrispc wrote:| then noticed that it told me that I had an unexpected ENDIF at row 562. Did that mean LINE 562? |
|
No, it meant what it said - row 562. The column and row numbers are displayed in the status bar:
http://www.bbcbasic.co.uk/bbcwin/manual/bbcwin1.html#cursor
'Modern' BASIC programs don't use line numbers, so they are not a useful way for the utility to report the location of an error.
Quote: Be more trusting! The report of an 'unexpected ENDIF' in row 562 is almost certainly correct and would explain, at least in part, the misbehaving indentation.
Richard.
|
|
Logged
|
|
|
|
|