To further confuse the issue, both ANSI/ECMA BASIC standards, in their minimal and full implementations, do not allow simple scalars an arrays to have the same name. This from ECMA-55: Minimal BASIC, page 9:
The same letter shall not be the name of both a simple variable
and an array, nor the name of both a one-dimensional and a two-
dimensional array.
(emphasis mine).
This is surprising, as:
Kemeny, one of the authors of Dartmouth BASIC, was on the ANSI standard committee;
Microsoft BASIC-80 v5 — which claims ANSI Minimal BASIC compatibility, including passing its test suite — allows arrays and scalars to share the same name.
For example, running this code through the strict bas55 Minimal BASIC interpreter:
10 DIM A(3)
20 LET A(1)=5
30 LET A=1
40 PRINT A,A(1)
50 END
results in the following errors:
30: error: type mismatch for variable A
info: it was previously used or DIM as a one-dimension array
LET A=1
^
40: error: type mismatch for variable A
info: it was previously used or DIM as a one-dimension array
PRINT A,A(1)
^
Every other interpreter I have runs the program without complaint.
A
, notH
. – OmarL Nov 23 '19 at 21:44