|
Enum Statement |
Top Previous Next |
Function: |
Declares a type for an enumeration. |
Syntax: |
enum name const1 [ = value1], const2 [ = value2], … end enum |
Scope: |
Global and HTML |
See Also: |
Part |
Description |
name |
Required. The name of the enum type. The name must be a valid Tibbo Basic identifier, and is specified as the type when declaring variables or parameters of the enum type. |
const[1, 2...] |
Required. The name for the constant in the enum. |
value1 |
Optional. A value associated with the constant. |
Details
Enum types can be useful for debugging purposes. When you add an enum type to a watch, you will see the constant name within the enum, and not a meaningless number.
By default, constants get incremental values, starting from 0 for the first item. You can think of this as a counter, enumerating the items in the list. Explicit values may be specified for any constant on the list. This also sets the counter to this explicit value. The counter will continue to increment from this new value.
Examples
enum my_enum my_const1, ' implicit value -- 0 is assumed my_const2 = 5, ' explicit value of 5, counter is set to 5 too. my_const3 ' Counter increments to 6,implicit value of 6. end enum
|