Language Overview

Previous  Next

 

The well known programming language BASIC is an acronym for Beginner's All-purpose Symbolic Instruction Code; when we mention BASIC today, we often refer to the BASIC family, not a specific one. The BASIC family has a long history since an original BASIC was designed in 1964 by John George Kemeny and Thomas Eugene Kurtz at Dartmouth College in New Hampshire; and BASIC is famous because it is easy to learn and use all the time.

 

MyBASIC2 implements all the standard features of the Basic Programming Language with a number of extensions such as structured elements and error handling.  Callable sub programs as well as functions and subroutines have been added as well.

 

The language is not case sensitive nor typed by default but it is encouraged to use the OPTION EXPLICIT to force variables to be declared before use.  Variables start with a letter.  Variables ending with the dollar sign ($) will be treated as strings if OPTION EXPLICIT is off.  Furthermore, the traditional Basic line numbers are not supported.  Labels are used for GOTO, GOSUB and ON ERROR.

 

OPTION MODULE "Example"

OPTION EXPLICIT

 

' Add the first 100 terms of a simple series MyBASIC2 automatically initializes variables to zero,

 

DIM n AS INTEGER

LET sum = 0

FOR n = 1 to 100

   LET sum = sum + 1/(n*n)

   PRINT n,sum

NEXT n

 

END