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

Possibly Related Threads…
Thread Author Replies Views Last Post
  Preserving multi-dim arrays Pete 5 416 12-19-2025, 03:17 PM
Last Post: Dimster
  Arbitrary CONST values Unseen Machine 31 2,879 10-29-2025, 05:44 AM
Last Post: bplus
  Array out of passing arrays... Pete 2 407 09-22-2025, 08:53 PM
Last Post: ahenry3068
  Huge array of variable length strings mdijkens 9 1,830 10-17-2024, 02:01 PM
Last Post: mdijkens
  An Array v's A Dictionary Dimster 10 1,868 10-08-2024, 06:59 PM
Last Post: TempodiBasic

Forum Jump:


Users browsing this thread: 1 Guest(s)