Programs written in a BASIC language other than GW-BASIC may require some minor adjustments before they can be run. The following sections describe these adjustments.
Delete all statements used to declare the length of strings. A statement such as the following:
DIM A$(I,J)
which dimensions a string array for J elements of length I, should be converted to the following statement:
DIM A$(J)
Some GW-BASIC languages use a comma or ampersand (&) for string concatenation. Each of these must be changed to a plus sign (+), which is the operator for GW-BASIC string concatenation.
In GW-BASIC, the MID$, RIGHT$, and LEFT$ functions are used to take substrings of strings. Forms such as A$(I) to access the Ith character in A$, or A$(I,J) to take a substring of A$ from position I to position J, must be changed as follows:
Other BASIC | GW-BASIC |
X$=A$(I) | X$=MID$(A$,I,1) |
X$=A$(I,J) | X$=MID$(A$,I,J-I+1) |
If the substring reference is on the left side of an assignment, and X$ is used to replace characters in A$, convert as follows:
Other BASIC | GW-BASIC |
A$(I)=X$ | MID$(A$,I,1)=X$ |
A$(I,J)=X$ | MID$(A$,I,J-I+1)=X$ |
Some GW-BASIC languages allow statements of the following form to set B and C equal to zero:
10 LET B=C=0
GW-BASIC would interpret the second equal sign as a logical operator and set B equal to -1 if C equaled 0. Convert this statement to two assignment statements:
10 C=0: B=0
Some GW-BASIC languages use a backslash (\) to separate multiple statements on a line. With GW-BASIC, be sure all elements on a line are separated by a colon (:).
Programs using the MAT functions available in some GW-BASIC languages must be rewritten using FOR-NEXT loops to execute properly.
Some GW-BASIC languages will always execute a FOR-NEXT loop once, regardless of the limits. GW-BASIC checks the limits first and does not execute the loop if past limits.