Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how do you use DIM?
#11
yeah, the only time you Really ever have to program starting with ones, is when you have to make it pretty for peopl, or just what theyre used to seeing anyways :P

in those cases where you have 1-12 with month i would just internally knock one off the answer the user would give me ;p


and guy that wants to know what dim is:


just imagine it like a number line like

0 1 2 3 4 5 6 7 8


etc. and each of those numbers has a number in them


_0____1_____2______3____4....

378__1982___45____342___87



all you would do is



Code:
dim array(4)
array(0) = 378
array(1) = 1982
array(2) = 45
array(3) = 342
array(4) = 87

for putit = 0 to 4 ' all your 5 data in one tight easily accessible package. Sweeet
  print "Array, index"; putit; ":"; array(putit)

next


hope that helps
Reply
#12
Nice example for using DIM, Cha0s.

However, I don't agree with the following statement you made:
"in those cases where you have 1-12 with month i would just internally knock one off the answer the user would give me"

I interpret that as meaning that when you ask the user for the month number, you subtract 1 to make it agree with the month table that you DIMed as (11).

Then throughout the program you have to keep remembering that monthtable 0 is for January, 1 is for February, etc. You could define constants for this, but why make things difficult for yourself? Why not just DIM the month table as (1 to 12), which is the natural order of things.
*****
Reply
#13
yeah you have a point. it all depends on what youre used to (and, i suppose, anyone maintaining your code as well)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)