Function Parameter

2025/12/27

Type
Learning Resource
Format
Glossary Article
Version
General
Subject Tags
Code
Assets
All else
Copyright 2016-2026, GDQuest
Created
2026/02/16
Updated
2025/12/27

Function Parameter

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 += 10

It 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_amount

When 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.

Become an Indie Gamedev with GDQuest!

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.

Nathan

Founder and teacher at GDQuest
  • Starter Kit
  • Learn Gamedev from Zero
Check out GDSchool

You're welcome in our little community

Get help from peers and pros on GDQuest's Discord server!

20,000 membersJoin Server

Contribute to GDQuest's Free Library

There are multiple ways you can join our effort to create free and open source gamedev resources that are accessible to everyone!