Qbasicnews.com

Full Version: DEFINT A-Z
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Quick Question.
ive seen it used and doent know what it does.

DEFINT A-Z

^---- what does this bit of code do?


i know this might be a realy stupid Question!
but bear with me, LOL im only human in a digital world!
It sets the default datatype for all non declared variables. This particular instruction sets the defaul type to integer the A-Z says that variables starting with A through Z should be defaulted to the INTEGER type (-32768 to 32767).

The main reason to use his is to accelerate things a bit. Somewhat of a shortcut.
i see, that makes sense,
thanx!
If your program doesn't start with a DEFINT or other DEFxxx, or you do a partial DEFINT like DEFINT A-J, then all the variables not covered will automatically default to SINGLE.
*****
Sorry, but I just wanna add a bit more because this really bit me in the ass before I had the internet. If you will think about it this way, I think it will make things really clear for ya. Wink

What is the answer to, say... 2 + 2?

4, right? :lol:

Well, it's only addition, right?

OK, so what is the answer to, say... 2.21765493 + 2.3769153?

Takes you a bit longer to figure that one out, aye? Well, it also takes the computer a while longer... not quite as long though. :lol:

Like they were sayin'... DEFINT makes all of QB's variables that begin with the letters A-Z, default to the INTEGER data type , instead of SINGLE floating point.