Possible with multiple strings?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By ErdnussMaus

I want to map an array of multiple strings to objects like:
[“blue”, “yellow”] → “res://green.tscn”
Is that also possible in a similar way?
Sidenote: even when the order of blue and yellow is different.

:bust_in_silhouette: Reply From: jgodfrey

One way would be to use a Dictionary where the key is the color array and the value is the scene. Something like this:

var dict = {
    ["blue", "yellow"]: "res://green.tscn",
    ["red", "yellow"]: "res://orange.tscn"
}

for key in dict.keys():
    print("%s, %s" % [key, dict[key]])