Liberty BASIC Help Online

See also:  Numeric Variables, String Literals and Variables, GLOBAL
A literal value is hard-coded into a program.  Here are two literals, printed to the mainwin.  The first is a number.  The second is a string of text characters.
    print 57
    print "Hello World"
        Hello World
A variable is a name used in the code that represents a string or numeric value.  The value assigned to the variable name may change as the program runs.  The program can always access the current value of the variable by refering to its name.  In this example, a value of "3" is assigned to a variable called myNumber:
    print myNumber   
If a different value is later assigned to the variable called myNumber:
    print myNumber   
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.  The variable names are uppercase and lowercase sensitive, so these are not the same variable:
As in most versions of BASIC, string variable names end in a "$" character for example:
  boast$ = "String variables can contain 2 million characters!"
The boast above is correct.  In Liberty BASIC, string variables can be huge, containing as many as 2 million characters.
Unlike some BASICs, Liberty BASIC does not require variables to be declared before they may be used in code.  It is importatnt to check the spelling/capitalization of variables, because variable names are case sensitive.  If 'Compiler Reporting' is enabled in the options dialog, Liberty BASIC will give an alert in a special pane at the bottom of the editor when a program contains variables with similar names, like (name$ and names$) or (name$ and Name$.)
In general, variables used in the main program code are not visible inside functions and subroutines.  Variables inside functions and subroutines are not visible in the main program.  Liberty BASIC 4 introduces the GLOBAL statement to create global variables. Variables declared as GLOBAL can be seen everywhere in a program.  The special system variables like WindowWidth, WindowHeight, etc. now have true global status.  GLOBALS are specified and used like this:
global true, false, filename$
filaname$ = "readme.txt"

Copyright (C) 2003 Shoptalk Systems
Liberty BASIC -