Having trouble retrieving items from an associative array
Posted: 07 Apr 2024, 00:32
I know that if I have an array Array := {a:"Apple", b:"Banana"}, I have to put the key in double quotes, as in var := Array["a"], but I can't figure out the syntax to use if the key is stored in a variable, as in
I have tried enclosing nextkey in %s and preceding it with "". It must be something simple but I can't think what.
Grateful for any help.
[Mod edit: Added [code][/code] tags. Please use them yourself when posting code!]
Code: Select all
nextkey := "a"
nextvalue := Array[nextkey]
Grateful for any help.
[Mod edit: Added [code][/code] tags. Please use them yourself when posting code!]