VerseIsland
FeedLearnLeaderboardGuidesReferenceExploreSearchDocsVerse Library
Sign in
Feed Learn 📖 Codex Leaderboard Guides Reference Explore Search Docs Verse Library
Browse UEFN›Verse Language·Up to UEFN · Verse Language·25 of 123 in Verse Language

Enum in Verse

Enum

Enum is short for enumeration, which means to name or list a series of things, called enumerators. This is a type in Verse that can be used for things like days of the week or compass directions.

Enum is short for enumeration, which means to name or list a series of things, called enumerators. This is a type in Verse that can be used for things like days of the week or compass directions.

Click image to enlarge.

direction := enum{Up, Down, Left, Right} Copy full snippet Creating an enum: Use the keyword enum followed by {}. If you want to specify initial elements in the enum, add the enumerators between the {}, separated by ,.
direction.Up Copy full snippet Accessing an enumerator: Use . on the enum, followed by the enumerator you want to use. For example direction.Up.

Persistable Type

An enum is persistable when defined with the persistable specifier. This means that you can use them in your module-scoped weak_map variables and have their values persist across game sessions. For more details on persistence in Verse, check out Using Persistable Data in Verse.

The following is an example of a persistable enum for the days of the week that can be stored, updated, and accessed later for a player.



|  | day := enum<persistable>: |
| --- | --- |
|  | Monday |
|  | Tuesday |
|  | Wednesday |
|  | Thursday |
|  | Friday |
|  | Saturday |
|  | Sunday |

Copy full snippet
Guided course

Add this to your free study plan — we’ll suggest related material and stitch it into one compile-checked lesson.

Keep exploring
More in Verse Language · 25 of 123
Prev
defer in verse
Next
expressions in verse
Browse all files in this folder (A–Z)

Source

Epic Games documentation

View original

Last updated 2024-12-05T00:00:00+00:00

VerseIsland· an archipelago of Verse & UEFN knowledge
🗺️ Island atlasLearnGuidesHistoryAbout & PressSources & LicensingPrivacy PolicyTermsStatus

Not affiliated with Epic Games. Fortnite, UEFN, Unreal Engine, and Verse are trademarks of Epic Games, Inc. Content is attributed to its source — see Sources & Licensing.

🦜

Scout · your island guide

The Isle of Verse