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

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 documentation

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

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 · 23 of 570
Prev
case in verse
Next
comments in verse
Browse all files in this folder (A–Z)

Source

Epic Games documentation

View original

Last updated 2026-03-08T05:07:36.564815+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