Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
suggestion: initialize array values within the DIM statement
#14
(12-21-2022, 09:37 PM)Spriggsy Wrote: I always dim all my arrays as MyArray(0 to 5) or whatever. I want 0 to be my first element and I want to be doubly sure that my array is the exact size that I'm wanting.

I'll have to admit I've never seen the need to do the '0 to whatever' part in naming an array.

DIM pete(100) is the same as DIM pete(0 TO 100)

Now Steve would say the problem we have here is 101 too many pete's to deal with, but I digress...

So what's the dif between these two ways to declare an array for this situation? I mean sure, for a different situation like DIM x(5 TO 10) I get, but DIM x(10) includes zero so it is the same as DIM x(0 TO 10).

pete
pete pete pete pete pete pete pete pete pete pete
pete pete pete pete pete pete pete pete pete pete
pete pete pete pete pete pete pete pete pete pete
pete pete pete pete pete pete pete pete pete pete
pete pete pete pete pete pete pete pete pete pete
pete pete pete pete pete pete pete pete pete pete
pete pete pete pete pete pete pete pete pete pete
pete pete pete pete pete pete pete pete pete pete
pete pete pete pete pete pete pete pete pete pete
pete pete pete pete pete pete pete pete pete pete
Reply


Messages In This Thread
RE: suggestion: initialize array values within the DIM statement - by Pete - 12-21-2022, 09:55 PM



Users browsing this thread: 2 Guest(s)