Liberty BASIC Family Compared to ViviFire

The syntax of Liberty BASIC and Run BASIC had an effect on ViviFire, but it is not the same language. This article gives a summary of the elements that are different.

Names

ViviFire lets you use Unicode in names of elements, such as variables and functions. You can use several scripts, such as Latin with diacritics, Greek, Cyrillic, Arabic, Chinese, and more.

All keywords and almost all names ignore letter case. Only units of measure must keep the same letter case. If a person writes a library with a different style, then frequently you can ignore it and use your style. See Declared Element Names for more information.

Scoping

Both LB and RB have rather complicated scoping rules compared to ViviFire. In ViviFire, any named entity defined outside of a code block is visible within it. That means that ViviFire has no need for a GLOBAL keyword, because anything defined at the outermost level is automatically global.

Like RB, block constructs (such as loops) create a new scoping level. This means that variables defined within these blocks are not visible outside them.

Also like RB, ViviFire allows for user-defined objects, but with much more functionality. Whereas RB reuses functions to define an object's methods, ViviFire has a Method keyword specifically for this purpose. Subs and Functions are always private to the object in which they are defined.

Labels

ViviFire has no support for branch labels. Although ViviFire permits the use of what look like labels in certain statements, be assured they are not labels. This means that all branching must be done in a structured way. These ways include

  1. procedures:
  2. Structured loops:
  3. Conditional statements:

ViviFire lacks GOSUB, but retains a form of GOTO. The GoTo Case statement is permitted within a Select…Case block.

Also, ViviFire lacks ON ERROR GOTO. Instead, it uses structured exception handling, using Try…Catch…Finally blocks.

Comparison of features

Feature equivalence

The following is a summary of the features of LB that should not require any changes to code being ported to ViviFire.

FeatureNotes
Arithmetic operators+, -, *, /, Mod, ^
Comparison operators<, <=, =, <>, >, >=
Do…Loop statementMulti-line form only
Exit statement
Function statementRB's privacy semantics aside
If…Then…Else statementBlock construct only
Logical operatorsAnd, Or, Xor; except when the precedence level matters. Each has a different precedence level.
ReDim statement
Sub statementRB's privacy semantics aside

Incompatibilities

The following table summarizes the situations where LB and ViviFire share keywords but they are used for different purposes.

FeatureNotes
GoTo
  • In LB, it is used to unconditionally branch to a label.
  • In ViviFire, it is used only in the GoTo Case statement which is available only inside a Select…Case block.
Rem
  • In LB, it is short for “remark” and marks the beginning of a remark that extends to the end of the line.
  • In ViviFire, it is short for “remainder” and is an operator related to Mod.
Return
  • In LB, it is used to mark the end of a GOSUB routine.
  • In ViviFire, it is a shorthand way to set the return value of a Function or Method and Exit, or is just another way to do Exit Sub.

Liberty BASIC and Run BASIC are trademarks of Shoptalk Systems.