Enums
An enum represents a symbolic name for a set of values, as data types. They can be used to create sets of constants with variables and properties. In other words, enums represent a list of values, each of which is always unique.
Let's have an example of an enum called "Currencies":
enum Currencies
{
EUR,
USD,
CHF
}
Create an Enum Folder
Create one by drag-and-dropping the Enum component from the Marketplace on the right side of the screen into the main editor.
Define the enums
After creating the enum, you can populate its values.
Each entry in an enum has a value
, which is an internal value used by the enum and a display name
, which can be a different text to be displayed to users. Reusing our list of currencies above, the value USD
could have US Dollar
as display name, and CHF
have Swiss Franc
.
The ordering of the values can also be changed using the up/down arrows.
Using an enum
Enums can be set as properties within Data Types, as input and output types in actions and functions, and as property types in visual components.
See the Expense App tutorial for an example of how it is used.
Reusing an enum in another project
In case the current project is imported by other projects, you may want to set the visibility of the enum to public
. By doing so, the enum will be visible within the importing projects.