If you want to check if a variable's data is a certain type - for instance, that a variable that should only hold a [[harlowe:number|number]] does indeed do so - then you can use these special values to do the comparison. To check if the data in $money is a number, write ''%%$money is a num%%''. Warning: you must write ''%%is a%%'' - don't write ''%%$money is num%%'', because ''%%is%%'' by itself checks if the left side exactly equals the right side, and ''%%num%%'' represents all numbers, not the specific number contained in $money. All of the datatypes are as follows. | **Value** | **Data type**| | ''%%number%%'', ''%%num%%'' | [[harlowe:number|Numbers]]| | ''%%string%%'', ''%%str%%'' | [[harlowe:string|Strings]]| | ''%%boolean%%'' | [[harlowe:boolean|Booleans]]| | ''%%array%%'' | [[harlowe:array|Arrays]]| | ''%%datamap%%'', ''%%dm%%'' | [[harlowe:datamap|Datamaps]]| | ''%%dataset%%'', ''%%ds%%'' | [[harlowe:dataset|Datasets]]| | ''%%command%%'' | [[harlowe:command|Commands]]| | ''%%changer%%'' | [[harlowe:changer|Changers]]| | ''%%color%%'', ''%%colour%%'' | [[harlowe:colour|Colours]]| Note that data that can't be stored in a variable doesn't have a corresponding datatype name, because you won't need to compare things to it. Additionally, along with the ''%%is a%%'' operator, there is a ''%%matches%%'' operator which is useful when you're dealing with data structures like [[harlowe:array|arrays]] or [[harlowe:datamap|datamaps]]. ''%%$pos is a array%%'' checks if $pos is an array, but that may not be precise enough for you. ''%%$pos matches (a: number, number)%%'' checks to see if $pos is an array containing only two numbers in a row. A data structure with datatype names in various positions inside it is called a **pattern**, and ''%%matches%%'' is used to compare data values and patterns. Some more pattern-matching examples: * ''%%(datamap:'a',2,'b',4) matches (datamap:'b',num,'a',num))%%'' is true. * ''%%(a: 2, 3, 4) matches (a: 2, num, num)%%'' is true. (Patterns can have exact values in them, which must be equal in the matching data). * ''%%(a: (a: 2), (a: 4)) matches (a: (a: num), (a: num))%%'' is true. To summarise, the two datatype-checking operators are: |**Operator** | **Purpose** | **Example**| | ''%%matches%%'' | Evaluates to [[harlowe:boolean|boolean]] true if the data on the left matches the pattern on the right. | ''%%(a:2,3) matches (a: num, num)%%''| | ''%%is a%%'', ''%%is an%%'' | Similar to matches, but requires the right side to be just a type name. | ''%%(a:2,3) is an array%%'', ''%%4.1 is a number%%''|