|
Qbasic Tutorial for beginners and children (Under Construction) |
Enhancing Program PresentationIt's important for you to enhance you program by:
Documenting your programAs you will notice later, programs may become huge, thus difficult to understand. The REM statement allows you to put remarks in your program. Any line starting with the REM statement is ignored at run-time. You can replace the REM statement by a single-quote ( ' ) symbol. The two lines below are similar: REM Program written by H.B. The single-quote form of REM can also be placed at the end of a line PRINT "Welcome everybody" 'Welcome message Using meaningful variablesThe use single-letter variables may be easy to type especially if your typewriting speed is slow. However they may cause your program to be difficult to understand in the long-run. The use of meaningful variables makes your program easier to understand and maintain. Here is an illustration:
Could you guess the code above? Now see how it is easy when meaningful variables are used:
Saying what is the purpose of the programMany novice programmers or children learning how to program, often neglect to say what is the purpose of their program. Example of an undocumented program:
As we said above, use the REM statement to put remarks, use meaningful variables and, at run-time, say what your program is doing.
|
|
|