
-----------------------------------
timtimpei
Tue Jan 15, 2008 4:45 pm

arrays initialization
-----------------------------------
k i need to initialize all my array variables the same thing, so

var num: array 1..70 of boolean := init (false, false, false,.....)

sigh... how do i make this easier?

-----------------------------------
StealthArcher
Tue Jan 15, 2008 5:01 pm

Re: arrays initialization
-----------------------------------
For loops my friend, they are wondrous beings.
Oh and if you are making what I think you are having a constant would be good also.


const numberofthings:int:=70
var chars:array 1..numberofthings of boolean
for v: 1..numberofthings
     chars(v):=false
end for

There, simple for loop initialization, make something similar for all other arrays that need it. Any other questions?

-----------------------------------
timtimpei
Tue Jan 15, 2008 5:05 pm

RE:arrays initialization
-----------------------------------
thx a lot

-----------------------------------
StealthArcher
Tue Jan 15, 2008 5:06 pm

RE:arrays initialization
-----------------------------------
No problem, always glad to help those willing to learn.

-----------------------------------
ericfourfour
Tue Jan 15, 2008 5:07 pm

RE:arrays initialization
-----------------------------------
Or if you don't know the upper or lower bound of the array:

upper (chars)
lower (chars)

-----------------------------------
StealthArcher
Tue Jan 15, 2008 5:08 pm

Re: arrays initialization
-----------------------------------
I assumed he did so I left it out, but anyhow, it's probably good for him to know.
