03-16-2025, 10:46 AM
This is not a bug, but expected behaviour: the constant was declared all in UPPERCASE, but then when used it's not.
Boriel BASIC by default is case-sensitive, meaning that, like in other languages like C, case matters. If you want to compile this program as is, you can use the command line parameter --ignore-case. :-)
When you use an undeclared variable, in Sinclair BASIC you will get the error "Variable not found". But in other BASIC flavours (like Boriel BASIC) an undeclared variable is automatically created the first time it's used with default value of 0. The type will be automatically guessed (usually Float for maximum compatibility) and a warning will be issued. If you don´t want this behaviour you can compile with the flags --explicit and --strict.
--explicit requires all variables and functions to be declared before being used.
--strict is even more strict: requires the variable to be declared and typed
Note: if using --strict you don´t need --explicit, because to type a variable / function you need to declare it first. That said, if you use BOTH, the errors messages will be clearer.
Boriel BASIC by default is case-sensitive, meaning that, like in other languages like C, case matters. If you want to compile this program as is, you can use the command line parameter --ignore-case. :-)
When you use an undeclared variable, in Sinclair BASIC you will get the error "Variable not found". But in other BASIC flavours (like Boriel BASIC) an undeclared variable is automatically created the first time it's used with default value of 0. The type will be automatically guessed (usually Float for maximum compatibility) and a warning will be issued. If you don´t want this behaviour you can compile with the flags --explicit and --strict.
--explicit requires all variables and functions to be declared before being used.
Code:
PRINT a: REM Error if compiled with --explicit
Code:
REM you can use #pragma to override command line flags. This one enforces explicit
#pragma explicit=true
DIM a: REM declares variable a with default (float) type
PRINT a
--strict is even more strict: requires the variable to be declared and typed
Code:
DIM a: REM will issue an error
Code:
DIM a As Ubyte
PRINT a
Note: if using --strict you don´t need --explicit, because to type a variable / function you need to declare it first. That said, if you use BOTH, the errors messages will be clearer.
---
Boriel
Boriel