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 · 23 of 570 in Verse Language
Browse Fortnite

Code Blocks in Verse

A code block, or block, is a group of zero or more expressions that introduces a new scoped body. (A block with zero expressions would be an empty block, and ideally would only be used as a placeholder to be filled in later.)

Code blocks can only appear after identifiers.

Scope refers to the part of the program where the association of an identifier (name) to a value is valid, and where that name can be used to refer to the value. For example, any constants or variables that you create within a code block only exist in the context of the code block. This means that the lifetime of objects is limited to the scope they're created in and they cannot be used outside of that code block.

The following example shows how to calculate the maximum number of arrows that can be bought with the number of coins the player has. The constant MaxArrowsYouCanBuy is created within the if block and therefore its scope is limited to the if block. When the constant MaxArrowsYouCanBuy is used in the print string, it produces an error because the name MaxArrowsYouCanBuy doesn't exist in the scope outside of the if expression.

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 Mar 8, 2026
    Keep exploring
    More in Verse Language · 23 of 570
    Prev
    case in verse
    Next
    comments in verse
    Browse all files in this folder (A–Z)
    Next up
    • A **code block**, or block, is a group of zero or more [expressions
    • Verse Glossary
    • For more details, see [module
    • Class In Verse
    • Interface In Verse
    • Block Formats
    Related topics
    • Verse Language Quick Reference Verse Language
    • Block In Verse Verse Language
    • Verse Glossary Verse Language
    • Basics Of Writing Code 6 Defining A Function In Verse Verse Language
    • Verse Glossary Verse Language

    Related

    Open in graph →

    Linked docs

    • Expressions In Verse
    • Verse Glossary

    Related topics

    • Block In Verse
    • Verse Language Quick Reference
    • Block In Verse
    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