Qbasicnews.com
Did I miss comething with variables? - Printable Version

+- Qbasicnews.com (http://qbasicnews.com/newforum)
+-- Forum: Qbasic "like" compilers/interpreters (http://qbasicnews.com/newforum/forum-5.html)
+--- Forum: FB Discussion & Programming Help (http://qbasicnews.com/newforum/forum-15.html)
+--- Thread: Did I miss comething with variables? (/thread-5972.html)



Did I miss comething with variables? - fsw - 02-09-2005

While playing around with old code I commented out some variable declarations and fbc compiled without errors.

Is this intentional?

If so 8)

Looked again at the changelog and found nothing about that...

BTW it's the cvs fbc dated Feb07.


Did I miss comething with variables? - na_th_an - 02-09-2005

You don't have to declare variables in BASIC.

Modern BASIC compilers (such as Visual Basic) added the directive "Option Explicit" to force the coder to declare variables.


Did I miss comething with variables? - fsw - 02-09-2005

Quote:... "Option Explicit" to force the coder to declare variables.
Yeah that's the one.
Finally I know what that does :oops:
Never worked with basic's that had "Option Explicit" :wink:
Actually this was the first example code I had without it :lol:
Thanks

Have to take a look into my fb-manual.
Manual, where is my manual.... :o
:bounce:


Did I miss comething with variables? - BastetFurry - 02-09-2005

Quote:You don't have to declare variables in BASIC.

Modern BASIC compilers (such as Visual Basic) added the directive "Option Explicit" to force the coder to declare variables.

Some are forced in that, look at BCX


Did I miss comething with variables? - v3cz0r - 02-10-2005

When using some lib is always safer to use option explicit, otherwise one misspelled constant/define used and nothing seems to work.. Explicit is not enabled by default to be backward compatible with QB/VB.


Did I miss comething with variables? - na_th_an - 02-10-2005

Quote:
na_th_an Wrote:You don't have to declare variables in BASIC.

Modern BASIC compilers (such as Visual Basic) added the directive "Option Explicit" to force the coder to declare variables.

Some are forced in that, look at BCX
And I bet that you can find a BASIC that fries eggs Tongue

That's not the standard, obviously. The Standard about basic says, basicly, three things:

1.- Simple procedural language for beginners
2.- Non case sensitive
3.- Variables don't need to be declared.


Did I miss comething with variables? - BastetFurry - 02-10-2005

Quote:And I bet that you can find a BASIC that fries eggs Tongue

Cool! I want that one! No wait, better a basic that can make some "coffe con leche"... hmm... i have the urge to pack the camper and have a drive to (Playa de) Oliva in Valencia, but on the other hand, dont like to drive ~1800 km just for a coffe.

Quote:1.- Simple procedural language for beginners

Ok

Quote:2.- Non case sensitive

No problem with that either

Quote:3.- Variables don't need to be declared.

Might be a problem.
At the beginning you give an integer called zyzig some value.
Some way down you call it zyzyg and some way down again you call it zizyg. Pool Of Errors i would say.


Did I miss comething with variables? - na_th_an - 02-10-2005

I'm not saying it's good, I'm saying "that's the way it is".

I know, that sucks, variables should be declared, but that's a new feature that was not in the specs of BASIC. Read the ISO Standard for Minimal BASIC to check it out.


Did I miss comething with variables? - MystikShadows - 02-12-2005

Quote:I'm not saying it's good, I'm saying "that's the way it is".

I know, that sucks, variables should be declared, but that's a new feature that was not in the specs of BASIC. Read the ISO Standard for Minimal BASIC to check it out.

Minimal BASIC is the keyword here.

ENUMS don't have to be there either but I pitty the fool that ever decides to take em off. LOL...

I would advice using Option Explicit (or at least declaring your variables) for any lib/binding that has been written by another language. For example, SDL, OpenGL, Allegro. Just to be on the safe side of things.


Did I miss comething with variables? - na_th_an - 02-13-2005

Again, that's the way to go. I was just pointing out that BASIC doesn't need you to declare variables. It's a language feature, it doesn't mean it is good practice nor that I encourage it. GOSUB is there, and it is not good practice either. LET or CALL are there, but you don't need to write those keywords.