Function Parameter
2025/12/27
- Type
- Learning Resource
- Format
- Glossary Article
- Version
- General
- Subject Tags
- Created
- Updated
- 2026/02/16
- 2025/12/27
A function parameter is a variable used in a function definition that acts as a placeholder for a value passed to the function when calling it.
It's a tool to parameterize a function: it allows the function to accept different values and to be more flexible.
Here's a function named heal() without any parameters:
var health := 100
func heal() -> void:
health += 10It always adds 10 to the health variable. But what if you want to heal by a different amount? You can use a parameter to make the function more flexible. Below, the heal() function has a parameter named heal_amount:
var health := 100
func heal(heal_amount: int) -> void:
health += heal_amountWhen calling the heal() function, we can provide a specific value for heal_amount in parentheses. In this call to the heal() function, heal_amount is set to 10:
heal(10)When calling the function, we call the value we pass to the function an argument.
Why do they have two different names? Parameters define the type of data a function can accept. They act as placeholders for the input values that the function will use. Arguments are the actual values passed to the function when it is called. They are real data that replace the parameters' placeholders during the function's execution.
Don't stop here. Step-by-step tutorials are fun but they only take you so far.
Try one of our proven study programs to become an independent Gamedev truly capable of realizing the games you’ve always wanted to make.
Get help from peers and pros on GDQuest's Discord server!
20,000 membersJoin ServerThere are multiple ways you can join our effort to create free and open source gamedev resources that are accessible to everyone!
Sponsor this library by learning gamedev with us onGDSchool
Learn MoreImprove and build on assets or suggest edits onGithub
Contributeshare this page and talk about GDQUest onRedditYoutubeTwitter…