Dictionary.Lookup

From Xojo Documentation

Method

Dictionary.Lookup(Key As Variant, defaultValue As Variant) As Variant

Supported for all project types and targets.

Looks up the passed value of Key. Returns a Variant.

Notes

If Key is found, it returns the corresponding value. If Key is not found, it returns the passed defaultValue.

Sample Code

This example looks up the passed color in the Dictionary.

Var d As New Dictionary
d.Value(RGB(255, 0, 0)) = "This is pure red."
d.Value(RGB(0, 255, 255)) = "This is pure cyan."

Var a As Variant
a = d.Lookup(RGB(255, 0, 0), "Default color")