VerseIsland
Feed Learn Leaderboard Guides Reference Explore Search Docs Verse Library
Sign in
Feed Learn 📖 Codex Leaderboard Guides Reference Explore Search Docs Verse Library
Fortnite › Verse Language · Up to Fortnite · Verse Language · 8 of 570 in Verse Language
Browse Fortnite

Practice Time: Declaring Variables and Constants

Let’s say you’re making a game with magic potions. Potions have different effects — they can heal players or hurt them. You would want to declare and initialize some constants and variables to store player health, and the amount of damage or healing caused by a potion.

But which should be constants, and which should be variables?

|  |  |
| --- | --- |
|  | var PlayerHealth: float = 100.0 |
|  | PotionDamageAmount: float = 20.0 |
|  | PotionHealAmount: float = 10.0 |

var PlayerHealth: float = 100.0 PotionDamageAmount: float = 20.0 PotionHealAmount: float = 10.0

Copy full snippet(3 lines long)

The variables and constants you're changing here won’t affect your Fortnite character's health, but you will learn how to do exactly that in a later lesson!

The player’s health will change during the game depending on what potions they use. When you think change, think variable.

On the other hand, it doesn’t make much sense to change the amount of damage or healing the potions do during the game, so those should be declared as constants.

  1. If you write code to change the PlayerHealth variable now, you won’t be able to tell if it worked unless you print something to the log. To help with that, declare and initialize the string constant and string variable below. Remember to add the space between the end of the text and the last ".

You're reading a preview

The full reference is free for BrainDeadGuild Discord members — sign in to read it all, or open the original at the source.

Sign in with Discord — free for members Read the original at Epic Games

Sign in with your BrainDead.TV / BrainDeadGuild Discord account for full access.

Comments

    Sign in to vote, comment, or suggest an edit. Sign in
    📄
    Source
    Epic Games

    © Epic Games. Official Epic developer documentation, shown here as a reference with a link to the original. All rights remain with Epic Games. Terms ↗

    View original Sources & licensing
    Request removal
    Last updated May 12, 2026
    Keep exploring
    More in Verse Language · 8 of 570
    Prev
    basics of writing code 2 practice time in verse
    Next
    basics of writing code 3 storing and using information in verse
    Browse all files in this folder (A–Z)
    Next up
    • Lesson 4: Writing Simple Code
    Related topics
    • Learn The Basics Of Writing Code In Verse Verse Language
    • Variables In Verse Verse Language
    • Verse Glossary Verse Language
    • Party Game 4 Reusable Game Manager In Unreal Editor For Fortnite General
    • First Island 05 Spice Up The Gameplay With Verse In Fortnite Tutorials

    Related

    Open in graph →

    Related topics

    • Learn The Basics Of Writing Code In Verse
    • Variables In Verse
    • Verse Glossary
    • Party Game 4 Reusable Game Manager In Unreal Editor For Fortnite
    • First Island 05 Spice Up The Gameplay With Verse In Fortnite
    VerseIsland · an archipelago of Verse & UEFN knowledge
    🗺️ Island atlas Learn Guides History About & Press Sources & Licensing Status

    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