# Source URL: https://dev.epicgames.com/documentation/en-us/uefn/defer-in-verse
# Local doc: epic-docs/documentation/en-us/uefn/defer-in-verse.md
# WARNING: Epic's page marks this snippet as click-to-expand. Only the preview portion was captured by the crawler — the full body is NOT in the markdown.
OnRoundEnd<public>() : void =
var ScoreThisRound : int = AddRoundScoreToTotalScore()
Print("Points scored this round: {ScoreThisRound}")
<# Adds RoundScore to TotalScore and resets RoundScore to 0.
Returns the RoundScore added. #>
AddRoundScoreToTotalScore<public>() : int =
defer:
set RoundScore = 0
UpdateUI()
Verse Library
verse
01 Snippet
Demonstrates using defer to guarantee variable resets and UI updates after a function returns.
extracted-snippets/documentation/en-us/uefn/defer-in-verse/01-snippet.verse