Control BASIC compiler bug

There is a bug in the compiler such that when you do have a line of the form:

VARA = VARB/2

The compiler will provide the error:
not a variable in line X: VARB/2

Any of the following do work:
VARA = VARB / 2
VARA = VARB /2
VARA = (VARB)/2

VAR is a keyword, try renaming them something else.

Fandu will make the error message more clear, mentioning its a keyword problem.

Any keywords, operators, and functions should be separated by Spaces so that the compiler can easily identify them.
So 10 VARA = VARB / 2 will compile
But for 10 VARA = VARB/2 the compiler does not know if VARB/2 is a variable or if it is a temporary variable, or if the user wants to express AVRB divided by 2
The compiler prompt is not a variable, and I will modify the code prompt to be more accurate. Thank you for your feedback.

1 Like

Hi Maurice, Fan Du,

I only used VARA and VARB as example variables. The actual variables used did not have VAR in the name. As for the the spacing, the biggest issue is the inconsistency. Using the VAR variables again for example purposes the following work,

VARA = VARB + 2
VARA = VARB +2

VARA = VARB - 2
VARA = VARB -2

VARA = VARB*2
VARA = VARB* 2
VARA = VARB * 2
VARA = VARB *2

VARA = VARB /2
VARA = VARB/2

Whereas the following do not:

VARA = VARB+2
VARA = VARB+ 2

VARA = VARB-2
VARA = VARB- 2

VARA = VARB/2
VARA = VARB/ 2

The section on “Control Basic Programming” in the documentation should help you.
Thank you!
https://temcocontrols.com/ftp/software/10SoftwareManual.zip

The key takeaway in all of this is you should leave a space between all math operators. Also steer away from using VAR anything in your naming, its a keyword.