Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
suggestion: initialize array values within the DIM statement
#8
(12-21-2022, 03:59 PM)mnrvovrfc Wrote: I was hoping SMcNeill would come over to show off one of his functions... but here is my attempt.

My way of doing this type of thing is really, really simple:

Code: (Select All)
DIM foo(10) AS INTEGER

foodata: DATA 1,2,4,6,8000,12,56,23,45,89,12

Restore foodata
FOR i = 1 to 10: Read foo(i): Next

The label and restore aren't required in the code above, but it's just one of them things that I've gotten into the habit of always using.  I *NEVER* do a READ with my DATA, without doing a RESTORE first.  I do too much work with library files and other such things, so I never go under the assumption that the data I want to read is necessarily the first data in the program (or the next data in the program).  Restore always puts you at the data you want, and I'm just in the habit of always using it.  Skip it, if you don't think you need it for your own uses.  Smile

A lot simpler than a function and parsing a string and all that complicated stuff.  Wink
Reply


Messages In This Thread
RE: suggestion: initialize array values within the DIM statement - by SMcNeill - 12-21-2022, 06:46 PM



Users browsing this thread: 2 Guest(s)