Comment (computer Programming) - Examples - in Context - BASIC

BASIC

This BASIC code fragment is a completely functioning program in which the comments describe what the program does for the benefit of novice programmers.

10 REM This BASIC program shows the use of the PRINT AND GOTO statements. 15 REM It fills the SCREEN with the word "WIKIPEDIA" 20 PRINT "WIKIPEDIA" 30 GOTO 20

When run, this program repeatedly prints the word "WIKIPEDIA" (without quotes) in an infinite loop.

In Microsoft BASICs, including QuickBasic, Qbasic, Visual Basic and Visual Basic .NET, any text on a line after an ' (apostrophe) character is placed is marked as a comment. Lines that begin with 'REM' are treated as comments as well, similar to other BASIC dialects. Following is an example in Visual Basic .NET:

Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click ' The following code is executed when the user ' clicks the button in the program's window. MessageBox.Show("Hello, World") 'Show a pop-up window with a greeting End Sub End Class

Read more about this topic:  Comment (computer Programming), Examples, In Context

Famous quotes containing the word basic:

    Justice begins with the recognition of the necessity of sharing. The oldest law is that which regulates it, and this is still the most important law today and, as such, has remained the basic concern of all movements which have at heart the community of human activities and of human existence in general.
    Elias Canetti (b. 1905)

    For a novelist, a given historic situation is an anthropologic laboratory in which he explores his basic question: What is human existence?
    Milan Kundera (b. 1929)

    There’s one basic rule you should remember about development charts that will save you countless hours of worry.... The fact that a child passes through a particular developmental stage is always more important than the age of that child when he or she does it. In the long run, it really doesn’t matter whether you learn to walk at ten months or fifteen months—as long as you learn how to walk.
    Lawrence Kutner (20th century)