This shows you the differences between two versions of the page.
Last revision Both sides next revision | |||
harlowe:datatype [2019/04/16 04:02] l created |
harlowe:datatype [2019/04/16 04:02] l |
||
---|---|---|---|
Line 5: | Line 5: | ||
All of the datatypes are as follows. | All of the datatypes are as follows. | ||
- | | Value | Data type| | + | | **Value** | **Data type**| |
- | |--- | + | |
| ''%%number%%'', ''%%num%%'' | [[harlowe:number|Numbers]]| | | ''%%number%%'', ''%%num%%'' | [[harlowe:number|Numbers]]| | ||
| ''%%string%%'', ''%%str%%'' | [[harlowe:string|Strings]]| | | ''%%string%%'', ''%%str%%'' | [[harlowe:string|Strings]]| | ||
Line 29: | Line 28: | ||
To summarise, the two datatype-checking operators are: | To summarise, the two datatype-checking operators are: | ||
- | | Operator | Purpose | Example| | + | |**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)%%''| | | ''%%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%%''| | | ''%%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%%''| |