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:

    Scientific reason, with its strict conscience, its lack of prejudice, and its determination to question every result again the moment it might lead to the least intellectual advantage, does in an area of secondary interest what we ought to be doing with the basic questions of life.
    Robert Musil (1880–1942)

    A kiss can be a comma, a question mark or an exclamation point. That’s basic spelling that every woman ought to know.
    Mistinguett (1874–1956)

    The man who is admired for the ingenuity of his larceny is almost always rediscovering some earlier form of fraud. The basic forms are all known, have all been practicised. The manners of capitalism improve. The morals may not.
    John Kenneth Galbraith (b. 1908)