Is it possible to create a multidimensional, associative array in VBScript?
I’m trying to recreate the following JScript code in VBScript:
names["teachers"] = ["Helen","Judy","Carol"];
names["students"] = ["George","John","Katie"];
For (var i=0; i<names["teachers"].length; i++) {
Response.Write(names["teachers"][i]);
}
My attempted VBScript:
dim names
SET names = CreateObject("Scripting.Dictionary")
names.Add "teachers", Array("Helen","Judy","Carol")
names.Add "students", Array("George","John","Katie")
There doesn’t seem to be an error creating the object, but I’m unable to figure out how I can loop through the arrays in VBScript.
There’s no real trick to iterating through this data structure. You do it just how you would expect to.