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·71 of 123 in Verse Language

The Rush Expression

Rush

The rush expression is used to run a block of two or more async expressions concurrently (simultaneously).

The rush expression is used to run a block of two or more async expressions concurrently (simultaneously).

When the fastest subexpression completes, any expression that follows the rush is evaluated, and any remaining subexpressions continue to evaluate.



|  | set WinnerResult = rush: |
| --- | --- |
|  | # All three async functions start at the same time |
|  | AsyncFunctionLongTime() |
|  | AsyncFunctionShortTime()  # This will win and its result is used |
|  | AsyncFunctionMediumTime() |
|  | # Next expression is called after the fastest async function (AsyncFunctionShortTime()) completes. |
|  | # All other subexpression tasks (AsyncFunctionLongTime(), AsyncFunctionMediumTime()) continue. |
|  | NextExpression(WinnerResult) |
|  | AsyncFunction4() |
|  | # If any rush subexpression tasks are still running when AsyncFunction4 completes |
|  | # then they are now canceled. |

Copy full snippet

The following code shows the syntax for the rush expression.



|  | expression0 |
| --- | --- |
|  | rush: |
|  | slow-expression |
|  | mid-expression |
|  | fast-expression |
|  | expression1 |

Copy full snippet

The diagram below shows the execution flow for the expressions.

Visualization of the order the expressions in the rush block finish Diagram showing the execution flow of the rush expression

Rush Expression Use

Where you can use a rush expression Async contexts
Invocation time of the rush expression Async
Requirements for rush code block The body of the rush expression must have at least two expressions, and all of the expressions must be async.
What the rush expression does Is similar to race, but expressions that complete after first completion continue. If any expressions effectively complete at the same simulation update, then the earlier encountered expression that completes breaks any tie. Any incomplete expressions continue to evaluate until they complete, or until the enclosing async context completes, at which point, any remaining losing expressions are canceled — whichever occurs first.
When the rush expression completes The rush expression completes when the first expression in the code block has completed. This could be the fastest, shortest length, first completed, or least amount of time to complete.
When the next expression after rush starts Any next expression that follows the rush expression is started when the completed expression finishes.
Result of the rush expression The result of a rush expression is the result of the first completed expression. The result type is the most common compatible type of all expressions in the code block.

A rush expression cannot currently be used in the body of an iteration expression like loop or for. If it must be used, then wrap it in an async function and have the iteration expression call that function.

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 · 71 of 123
Prev
run your first verse program in unreal editor for fortnite
Next
sorting algorithms 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