Assigning Arrays
Author |
Message |
AzureFire
![](http://compsci.ca/v3/uploads/user_avatars/144210120463a831da922a.png)
|
Posted: Wed Nov 30, 2005 6:00 pm Post subject: Assigning Arrays |
|
|
Is there a way to set every value of an array all at once?
I need to set them all to false, so after a condition is met, they can be set to true. |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
MysticVegeta
![](http://www.geocities.com/ohsoinsane/my_avatar.JPG)
|
Posted: Wed Nov 30, 2005 6:03 pm Post subject: (No subject) |
|
|
code: | for x : 1..upper(arr)
arr(x) := false
end for |
|
|
|
|
|
![](images/spacer.gif) |
Cervantes
![](http://compsci.ca/v3/uploads/user_avatars/1023105758475ab2e040bde.jpg)
|
Posted: Wed Nov 30, 2005 6:09 pm Post subject: (No subject) |
|
|
Also, look into init.
code: |
var my_array : 1 .. 5 of int := init (3, 7, 42, 8, 4)
|
|
|
|
|
|
![](images/spacer.gif) |
AzureFire
![](http://compsci.ca/v3/uploads/user_avatars/144210120463a831da922a.png)
|
Posted: Wed Nov 30, 2005 6:13 pm Post subject: (No subject) |
|
|
thanks, that was nice and fast ![Smile Smile](http://compsci.ca/v3/images/smiles/icon_smile.gif) |
|
|
|
|
![](images/spacer.gif) |
wtd
|
Posted: Thu Dec 01, 2005 2:13 pm Post subject: (No subject) |
|
|
code: | let my_array = Array.init 5 (fun _ -> false) |
Oh, right, Turing. ![Wink Wink](http://compsci.ca/v3/images/smiles/icon_wink.gif) |
|
|
|
|
![](images/spacer.gif) |
|
|