Home Previous section Next section

Adding documentation to your programs


Documenting your program (also called "commenting") allows you to remind yourself about something in your program. Plus, if your program is seen by other people, documenting can help them understand your code.

The REM (remark) command enables you to add comments to your program without the text being treated like an instruction.
    CLS
    PRINT "Some text"

    REM This text is ignored.

    REM This program clears the output screen,
    REM and then prints "Some text."

TIP: You can use an apostrophe instead of the REM command.

' Comment goes here


You can add REM to the same line as another command by placing a colon after the first instruction.
    CLS:          REM This command clears the screen
    PRINT "Text": REM This command prints "Text" to the screen
    PRINT 534:    REM This prints the number 534 to the screen
NOTE: If you use an apostrophe instead of REM while doing this, you do not need to add a colon.
    CLS           ' This command clears the screen
    PRINT "Text"  ' This command prints "Text" to the screen
    PRINT 534     ' This prints the number 534 to the screen

Next section


Feel free to distribute this tutorial, upload it to your website, link to it from your site, etc.

http://www.geocities.com/progsharehouse/qbtutor
Mirror: http://development.freeservers.com/qbtutor