Enums
Learn about creating enums, which allow you to create variables that are constrained to a specific set of values.
Last updated
Was this helpful?
Learn about creating enums, which allow you to create variables that are constrained to a specific set of values.
Last updated
Was this helpful?
In Yarn Spinner 3, enums let you create variables whose value is constrained to a pre-defined list of possibilities.
To define an enum you must provide a name, and some cases for it. Here's a new enum called Food
with the cases Apple
, Orange
, and Pear
:
Once you've created an enum, you can use it just like any other variable: