Since the mapping data type allows you to use values of different data types, are there any way to check what datatype an entry is?
Say you're iterating through the keys of a mapping where some values are integers and some are strings. It would be convenient to know what kind data type they are before using the values.
As an extension to this question, are there any way to figure out the data type of an anytype/mixed variable once it has been assigned a value?
Deducing the type of a mapping value
- buec
- Posts:28
- Joined: Tue Dec 07, 2010 3:09 pm
Re: Deducing the type of a mapping value
You can check the variable type with getType() and getTypeName().
- ottemot
- Posts:13
- Joined: Wed Dec 02, 2015 2:30 pm
Re: Deducing the type of a mapping value
Excellent, thank you!