Liberty BASIC (LB) is a commercial computer programming language and integrated development environment (IDE). It has a compiler which recognizes its own dialect of the BASIC programming language. It runs on 16- and 32-bit Windows and OS/2.
Liberty BASIC has been used in examples of code for various guides and references about programming in Windows, including "Beginning Programming For Dummies", by Wallace Wang.
Though Liberty BASIC has its share of limitations in its design for advanced programming, it makes a credible and very usable introductory integrated development environment, IDE, for moderate to advanced users of Windows and OS/2. DLLs are available with functions allowing users to overcome most of the limitations in Liberty BASIC. The OS/2 version is very old, but free. A new version that will run on Windows, Macintosh and Linux is in active development.
The Liberty BASIC dialect, and IDE, have developed a market niche for introductory and intermediate programmers who are learning the skills of programming, though it has been less widely adopted as a commercial publishing product. This does not mean that Liberty Basic is educational software only. It is still a commercial product, and can be used to create proprietary software.
As of now, Liberty Basic is not considered to be a true compiler. Liberty Basic translates the code written in the IDE to a 'tokenized' file with the extension: "tkn". This file is then interpreted by an executable file that carries the same file name. Although, this may change with the release of version 5.
A central idea in creating Liberty BASIC was to model the handling of windows after the syntax for file handling. For example, (from the Liberty BASIC Help File):
"The OPEN command opens communication with a device, which can be a disk file, a window, a dynamic link library or a serial communications port."
This general purpose syntax is one of the features of LB that make it easier to learn.
Once a “device” is open, data and also commands to control that device can be “printed” to it. For each type of device there is a set of commands which can be sent to it in this way. In the more recent versions of LB the word "print" may be dropped from the "print" statement, making the syntax even simpler.
Simplicity has been at the heart of Liberty BASIC from the beginning. This makes it easier to learn but at some cost, perhaps, in limiting functionality. Only two data types are supported in LB4.03: numeric and string. No type declarations are required: any variable with a $ sign at the end of its name is a string variable; otherwise it is numeric. (The plan for LB5 is to support other types and user defined types as well as these.) For the purpose of making calls to API or 3rd party DLLs there is a STRUCT and the additional types necessary for the DLL. The only other data structure currently supported is the ARRAY. Arrays of one or two dimensions are supported. LB5 may support arrays of user-defined types.
"Hello world" program:
Program to display a pop-up message box with the words "Hello, World!" on it:
Program to display an input box:
Running another application using Liberty BASIC:
Printing multiplication table of 5 on form: