BBC BASIC for Windows
« REPEAT loops indentation »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 11:47pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: REPEAT loops indentation  (Read 896 times)
rtr2
Guest
xx 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 » User IP Logged

rtr2
Guest
xx 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.
User IP Logged

chrispc
New Member
Image


member is offline

Avatar




PM


Posts: 19
xx 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
User IP Logged

rtr2
Guest
xx 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:
What now?

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.
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls