Posts: 484
Threads: 14
Joined: Apr 2005
For the spelling mistake bugs, i prefer Option Explicit to catch those. I do now tend to use the (a To z) format aswell, as i think it gives a clearer picture. I'm not very impressed with the Dim foo(3) being 0 To 3, and not 0 To 2 as i would expect.
EVEN MEN OF STEEL RUST.
Posts: 243
Threads: 12
Joined: Aug 2001
Quote:For the spelling mistake bugs, i prefer Option Explicit to catch those.
I have not been to this forum in a while and there must be some assumptions I don't know about.
"Option Explicit"?
That is not a capability of QBasic that I know of. I always use it in Visual Basic. Has this forum converted to be a Visual Basic forum?
Anyway, in QBasic I sometimes use
DEFSTR A-Z
to do the equivalent of OPTION EXPLICIT.
And from time-to-time I change it to
DEFDBL A-Z just to see if I messed up on strings.
Mac
Posts: 961
Threads: 81
Joined: Apr 2005
Same applies for DEFINT A-Z for integers.
Screwing with your reality since 1998.
Posts: 484
Threads: 14
Joined: Apr 2005
I see, i only used QB a few times about 10 years ago so i don't remember, i assumed it had Option Explicit too.
This is not a qb forum, this is newbie help.
EVEN MEN OF STEEL RUST.
Posts: 243
Threads: 12
Joined: Aug 2001
Quote:This is not a qb forum, this is newbie help.
Newbie in what? Chess? SuDoku? Programming such as Fortran, Cobol, C, HTML, IBM7090 Mainframe assembly code?
As it is called "QBasic News", I would assume a newbie in QBasic.
What is your logic?
Mac
Posts: 2,771
Threads: 96
Joined: Oct 2003
Quote:This is not a qb forum, this is newbie help.
It is quite clearly under the QB category in the index.
Posts: 1,956
Threads: 65
Joined: Jun 2003
Quote:I used to always just code DIMs like
DIM S(100) as integer
even though I planned to only use (1 to 100).
Why? Because it was quick and easy and I didn't mind wasting S(0).
However, I've come to appreciate (1 to 100) more, and certainly not to save one measly cell.
The reason: a good protection against this bug:
y%=S(leest1)
when I meant
y%=S(least1)
My spelling error will, of course, go unnoticed by QBasic. I get the equivalent of y%=S(0).
If I use (100) or (0-100) then y%=S(0) has a legal value and thus I get y%=0 and have a hard time finding this bug.
If I use (1-100) y%=S(0) will fail immediately (OUT OF RANGE).
Mac
Congrats, Mac, very good explanation.
*****
really, no need to cry, qbasic served its purpose for many years.