Structure of BASIC Program
A program consists of a series of lines containing statements that define what your program does. Each line consists
of a statement together with a mixture of expressions, operators, variables, constants and function calls.
Your programs are created from a series of one or more statements. Examples of statements are:-
SUB and FUNCTION.
A constant is an unnamed value that cannot be altered while your program is running. There are six
types of constants:- Boolean Constants (true or false), Integer Constants (e.g. 25, 36, -7 etc.),
Long Constants (e.g. 3142L), Single Precision Floating Point Constants (e.g. 3.142f),
Double Precision Floating Point Constants (e.g. 3.142 or 3.142d) and String Constants (e.g. “Hello”).
A variable is a named item that can be used to store values which change over time. You can store a value
in a variable, access its current value or replace it with another value.
Variable names consist of an alphabetic character (a-z) followed by one or more alphanumeric characters
together with the underscore character. Variable names are case insensitive so “ABC”, “Abc” and “abc” all
reference the same variable. Variables must be defined to be a specific
Data Type using the DIM
statement before they are used.
A function is a named routine that returns a value depending on its input arguments. A function’s
input arguments may be variables, constants or expressions. There are two types of functions:- built in
functions and user defined functions. User defined functions are defined using the
Operators are used when you write expressions and define the operations to be performed. Addition (+),
Subtraction (-), Multiplication (*) and Division (/) are all examples of operators.