Forum Discussion
Arie
Altostratus
Apr 27, 2008Syntax for arrays?
Apparently arrays are more efficient than Data Lists (matchclass), but I am unable to find the syntax to set the array (and populate it) and how to use it for a matchclass-equivalent.
- Nicolas_Menant
Employee
Arrays give you the capability to store any kind of information based on an index, here are some examples about how to manipulate those data:create array:
insert data:array set ::Connexiondata { } Here the name of our array will be connection data
find data:set ::Connexiondata($myUserID) $uri Here we insert our data ($uri) in our data through the index $myuserid
Check all data:if {[info exists ::Connexiondata($myUserID)]} { Here we check if we have some data for the index $myuserid set user_data $::Connexiondata($myUserID) Here we retrieve the data based on the index }
Remove data:foreach { data } [array names ::Connexiondata] { on this loop we will extract all data inserted in Connexion data and assign it to $data }
unset ::Connexiondata($index) Here we remove the data that are linked to the index $index
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects