Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
DIM - AS - VARIABLE TYPE likely bug
#6
first of all, unless you are using option _explicit you don't have to dim single varaibles before using them
dim a%
or
dim as integer a
or
dim a as integer
or
defint a-z
or
redim a%
or
redim as integer a
or
redim a as integer

7 different ways to make a an integer type

btw if you start dim as integer you can list a bunch of variables to dim as integer
dim as integer a, b, c, d
use as first after dim though so all a, b, c, d are integer

dim a as integer, b, c, d
makes a integer but b, c, d will use default single type

again, without option _explicit, you can just start using a% ;-)) and thats fine for a little code snippet specially
it will be 0 until you assign another value to it

it is good programming form to define your variables before using them and option _explicit will tell you immediately if you mistyped or are trying to use an undefined variable.

you do have to dim arrays with > 11 items
Code: (Select All)
For i = 0 To 10
    arr(i) = i ' ha ha free pass from dim
Next
b = b + ...
Reply


Messages In This Thread
DIM - AS - VARIABLE TYPE likely bug - by bartok - 05-03-2024, 06:59 AM
RE: DIM - AS - VARIABLE TYPE likely bug - by bplus - 05-03-2024, 12:41 PM



Users browsing this thread: 2 Guest(s)