Task

Demonstrate a language's methods of:

   variable declaration
   initialization
   assignment
   datatypes
   scope 
   referencing,     and 
   other variable related facilities


 
'In Liberty BASIC variables are either string or numeric.
'A variable name can start with any letter and it can contain both letters and numerals, as well as dots (for example: user.firstname).
'There is no practical limit to the length of a variable name... up to ~2M characters.
'The variable names are case sensitive.
 
'assignments:   -numeric variables. LB assumes integers unless assigned or calculated otherwise.
'Because of its Smalltalk heritage, LB integers are of arbitrarily long precision.
'They lose this if a calculation yields a non-integer, switching to floating point.
    i = 1
    r = 3.14
 
'assignments    -string variables. Any string-length, from zero to ~2M.
    t$    ="21:12:45"
    flag$ ="TRUE"
 
'assignments    -1D or 2D arrays
'A default array size of 10 is available. Larger arrays need pre-'DIM'ming.
    height( 3)          =1.87
    dim height( 50)
    height( 23)         =123.5
    potential( 3, 5)    =4.5
    name$( 4)           ="John"
 
'There are no Boolean /bit variables as such.
 
'Arrays in a main program are global.
'However variables used in the main program code are not visible inside functions and subroutines.
'They can be declared 'global' if such visibility is desired.
'Functions can receive variables by name or by reference.
 