Assigning Arrays
Author |
Message |
AzureFire
|
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. |
|
|
|
|
|
Sponsor Sponsor
|
|
|
MysticVegeta
|
Posted: Wed Nov 30, 2005 6:03 pm Post subject: (No subject) |
|
|
code: | for x : 1..upper(arr)
arr(x) := false
end for |
|
|
|
|
|
|
Cervantes
|
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)
|
|
|
|
|
|
|
AzureFire
|
Posted: Wed Nov 30, 2005 6:13 pm Post subject: (No subject) |
|
|
thanks, that was nice and fast |
|
|
|
|
|
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. |
|
|
|
|
|
|
|