arrays initialization
Author |
Message |
timtimpei
|
Posted: Tue Jan 15, 2008 4:45 pm Post subject: 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? |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
StealthArcher
![](http://compsci.ca/v3/uploads/user_avatars/18949255664b176c4f1481b.jpg)
|
Posted: Tue Jan 15, 2008 5:01 pm Post subject: 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.
code: |
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? |
|
|
|
|
![](images/spacer.gif) |
timtimpei
|
Posted: Tue Jan 15, 2008 5:05 pm Post subject: RE:arrays initialization |
|
|
thx a lot |
|
|
|
|
![](images/spacer.gif) |
StealthArcher
![](http://compsci.ca/v3/uploads/user_avatars/18949255664b176c4f1481b.jpg)
|
Posted: Tue Jan 15, 2008 5:06 pm Post subject: RE:arrays initialization |
|
|
No problem, always glad to help those willing to learn. |
|
|
|
|
![](images/spacer.gif) |
ericfourfour
|
Posted: Tue Jan 15, 2008 5:07 pm Post subject: RE:arrays initialization |
|
|
Or if you don't know the upper or lower bound of the array:
upper (chars)
lower (chars) |
|
|
|
|
![](images/spacer.gif) |
StealthArcher
![](http://compsci.ca/v3/uploads/user_avatars/18949255664b176c4f1481b.jpg)
|
Posted: Tue Jan 15, 2008 5:08 pm Post subject: Re: arrays initialization |
|
|
I assumed he did so I left it out, but anyhow, it's probably good for him to know. |
|
|
|
|
![](images/spacer.gif) |
|
|