types
Key and value types of a dictionary.
Category: Language Fundamentals > Data Types
Syntax
[keyType, valueType] = types(D)
Returns the data types that D was configured with.
Description
A dictionary stores values under keys; every key has the same type, and so does every value. types reports those two types, which is useful when a dictionary was built by other code and you want to know what it accepts.
Input arguments
D- dictionary object.
Output arguments
keyType- Class name of the keys, as a string.
valueType- Class name of the values, as a string.
Example
Types of a dictionary
d = dictionary("a", 1);
[kt, vt] = types(d)
Output
kt = "string"
vt = "double"