Dictionary.Lookup

From Xojo Documentation

You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!
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(Color.Red) = "This is pure red."
d.Value(Color.Blue) = "This is pure blue."

Var a As Variant
a = d.Lookup(Color.Red, "Default color")