Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Assigning Arrays
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
AzureFire




PostPosted: 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
Sponsor
sponsor
MysticVegeta




PostPosted: Wed Nov 30, 2005 6:03 pm   Post subject: (No subject)

code:
for x : 1..upper(arr)
arr(x) := false
end for
Cervantes




PostPosted: 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




PostPosted: Wed Nov 30, 2005 6:13 pm   Post subject: (No subject)

thanks, that was nice and fast Smile
wtd




PostPosted: Thu Dec 01, 2005 2:13 pm   Post subject: (No subject)

code:
let my_array = Array.init 5 (fun _ -> false)


Oh, right, Turing. Wink
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: