Writing Structured Code
Tek

Overview...
Actually, the first structured code tutorial wasn't quite on the subject of structured code, it was really meant as a guide to how to space code over. So, I'll just provide a more clear example of that now. When we write code, we have different constructs in it, which are really just sort of groups, and we can define these groups by spacing them over, based on their hierarchy. Huh? Okay, well, when you make a DO .. LOOP everything inside the loop is inside it's hierarchy, so to speak, so, stuff in there can be spaced over. Observe:

DO
 PRINT "This statement is INSIDE the do, so space it over."
LOOP

Get it? Similarly, if we had another DO LOOP in side the loop, you space that over. Now you don't have to space the statements over, but I'm just saying it's a good idea, because then it's super easy to tell what's going on. You can easily identify the different areas of your code. The compiler doesn't really care if it's spaced. When compiling, it's all the same, as if the spacing wasn't there. When you run the qb program, it doesn't matter either, because qbasic running is a p-code interpreter, a sort of cross between an .exe and the .bas. Other statements to space should include:

That all for now...
That's all on spacing code for now, watch out for other tutorials.


This tutorial was written by Tek (neozones@geocities.com), who's webpage is located at www.geocities.com/~neozones.