Variable Types
Variable Types
Rhyme uses a type system to help ensure your variables contain the right kind of data. When a function action returns a value, it will be one of these types.
Type Reference Table
Base Types
| Type | Value | Description |
|---|
| ANY | 0 | Any type of value |
| DEPENDS | 1 | Type depends on context |
| ERROR | 255 | Error value |
String Types
| Type | Value | Description |
|---|
| TEXT | 17 | Plain text string |
| IMAGE | 18 | Image reference |
| CEV | 19 | Custom element value |
| B64 | 20 | Base64 encoded data |
| URI | 21 | Web address (URL) |
| EMAIL | 22 | Email address |
| PHONE | 23 | Phone number |
| COLOR | 24 | Color value |
| PASSWORD | 25 | Password (hidden) |
| JSON | 26 | JSON data |
| LANGTEXT | 27 | Language-specific text |
| UUID | 28 | Unique identifier |
| BLOCKNAME | 29 | Rhyme block name |
| DATURI | 30 | Data URI |
Number Types
| Type | Value | Description |
|---|
| NUMBER | 33 | Numeric value |
| EPOCHTIME | 34 | Unix timestamp |
| DURATION | 35 | Time duration |
| PRICE | 36 | Price/currency value |
Boolean Types
| Type | Value | Description |
|---|
| BOOLEAN | 49 | True/false value |
Item Types
| Type | Value | Description |
|---|
| ITEM | 65 | Generic item object |
| PERSON | 66 | Person record |
| APP | 67 | App information |
| RESOURCE | 68 | Resource reference |
| SCHEDULE | 69 | Schedule data |
| CALENDAR | 70 | Calendar data |
| RESPONSE | 71 | API/action response |
| ORDER | 72 | Order data |
| ROW | 73 | Data row |
| VARREC | 74 | Variable record |
Group Types
| Type | Value | Description |
|---|
| GROUP | 81 | Group of items |
| GRP_STRING | 82 | Group of strings |
| GRP_NUMBER | 83 | Group of numbers |
| GRP_BOOLEAN | 84 | Group of booleans |
| GRP_ITEM | 85 | Group of items |
| GRP_BINARY | 86 | Group of binary data |
| GRP_GROUP | 87 | Group of groups |
| GRP_PERSON | 88 | Group of people |
| GRP_TABLE | 89 | Table data |
Binary Types
| Type | Value | Description |
|---|
| BIN_DATA | 97 | Binary data |
| BIN_IMG | 98 | Binary image |
| BIN_RHC | 99 | Compiled Rhyme code |
DateTime Types
| Type | Value | Description |
|---|
| DT_DATETIME | 113 | Date and time |
| DT_DATEONLY | 114 | Date only |
| DT_TIMEONLY | 115 | Time only |
| DT_DURATION | 116 | Time duration |
| DT_DAYNUM | 117 | Day number |
| DT_MMDD | 118 | Month/day |
| DT_DAYNUMTIME | 119 | Day number with time |
Using Types
When you see a function action that returns a value, the documentation will show which type it returns. For example:
is-valid-email returns a BOOLEAN (true/false)send-email returns a RESPONSE (information about whether the email was sent)core-kv-get returns a VARREC (variable record)
This helps you know what kind of data to expect when storing the result in a variable:
$is-valid = is-valid-email "[email protected]" // Returns BOOLEAN
$result = send-email // Returns RESPONSE