VerseIsland
Feed Learn Leaderboard Guides Reference Explore Search Docs Verse Library
Sign in
Feed Learn 📖 Codex Leaderboard Guides Reference Explore Search Docs Verse Library
UEFN › Input & Controls · Up to UEFN · Input & Controls · 5 of 13 in Input & Controls
Browse UEFN

Lesson 8: Input, Parameters, and Arguments

Lesson 8: How Input, Parameters, and Arguments Work

Input is information added to a program and used by code to make changes.

Input is information added to a program and used by code to make changes.

The function examples given in the previous lesson didn’t need any input:

GetNumberOfMousetrapsYouCanAfford() : int
Copy full snippet

You know this because the parentheses () in the function signature above are empty.

Parameters

You can define the input a function needs by adding a parameter to the function signature.

A parameter is a constant that’s declared in the function signature between the parentheses. When a parameter is set, you can use it in the body of the function.

The syntax for a function that includes a parameter looks like this:



|  | name(parameter : type) : type = |
| --- | --- |
|  | codeblock |

Copy full snippet

In the following example, CoinsPerMousetrap is now a parameter for the function BuyMousetrap():



|  | var Coins : int = 500 |
| --- | --- |
|  |  |
|  | BuyMousetrap(CoinsPerMousetrap : int) : void = |
|  | set Coins = Coins - CoinsPerMousetrap |
|  | Print("Mousetrap bought! You have {Coins} coins left.") |

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 Dec 5, 2024
    Keep exploring
    More in Input & Controls · 5 of 13
    Prev
    keyboard shortcuts in unreal editor for fortnite
    Next
    uefn controls for creative users in unreal editor for fortnite
    Browse all files in this folder (A–Z)
    Next up
    • Practice setting parameters and arguments for functions.
    Related topics
    • Learn Code Basics 3 Storing And Using Information In Verse Verse Language
    • Learn Code Basics 1 Basic Programming Terms In Verse Verse Language
    • Learn Code Basics 5 Writing Reusable Code In Verse Verse Language
    • Functions In Verse Verse Language
    • Learn Code Basics 2 Basic Programming Components In Verse Scene Graph

    Related

    Open in graph →

    Related topics

    • Learn Code Basics 3 Storing And Using Information In Verse
    • Learn Code Basics 1 Basic Programming Terms In Verse
    • Learn Code Basics 5 Writing Reusable Code In Verse
    • Functions In Verse
    • Learn Code Basics 2 Basic Programming Components 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