A Basic program -- missing array index?

If someone can help me with this I'd be grateful. I've asked this question on other forums, gotten lots of views but no answer. It's no big deal but maybe someone has a solution.

I've have a program written in BASIC. I did not write the program and I have no way to contact the original programmer.

Here's the big problem. There are quite a few lines in the code like this one

NH(N) = NH

NH has been declared by

DIM NH(20)

but the variable on the right does not have an index and this makes the compiler unhappy. I originally suspected that whatever compiler the programmer was using had some sort of default index feature, probably 1 or 0. Lately I've begun to think that the programmer never did get it to run.

I meant a bit more than one line...
Error 72 says you want to specify WHICH element of array S has to be compared with the number 999.
Perhaps at first S was an integer variable and has changed to an integer array without this routine being updated...

I may be mistaken, it was a looooong time ago, but I think you may have been able to have distinct variables NH and NH().
Certainly NH%, NH!, NH# and NH$ would be distinct variables (integer, single, double and string) capable of holding four different values at the same time. Whether NH and NH() add more options, I'm not certain.

Edit: this comes from TRS80 Basic. There were many dialects of Basics. I think this would not have applied to the early MS Basics.

Staff: Mentor

I may be mistaken, it was a looooong time ago, but I think you may have been able to have distinct variables NH and NH().
Certainly NH%, NH!, NH# and NH$ would be distinct variables (integer, single, double and string) capable of holding four different values at the same time. Whether NH and NH() add more options, I'm not certain.

I was thinking the same thing but didn't weigh in. It's sort of like different namespaces for variables based on their type (i.e., integer, floating point, string). Apple Basic had the same concept -- that the suffix determined the type of variable. It could very well be that identifiers NH and NH(1) represented different things.

Please post the code block (at least the 10 previous lines). It doesn't have to be everything, but we need context.
If there are relevant variable declarations (which might be way up at the top), it woud be good to include those too.

Please post the code block (at least the 10 previous lines). It doesn't have to be everything, but we need context.
If there are relevant variable declarations (which might be way up at the top), it woud be good to include those too.

I want to thank everyone for their input.

This is the start of the program. I think the Dim statements are the only declarations.

Well, there is no NH in that block of code, so your opening post isn't helpful.

One thing you are going to have to learn is how to describe a bug concisely. You've got us chasing geese.

Describe the exact error, word for word.
Show the exact line that is causing the error (or at least where the program terminated).
Show as much code as is necessary to provide context. (which you have now done)

As BvU points out, it does seem that S is both a primitive and an array.
It is declared as S(20) in line 30, yet it is used as an input S (which will surely be a string) in lines 890 and then 930.