void is the keyword used in GDScript to indicate that a function doesn't return anything.
This is useful to guarantee that a function doesn't return a value. Note that returning null is not the same as returning nothing. null is a value, while returning nothing means the function doesn't give you anything back.
For example, this is not valid GDScript:
funcdo_nothing()->void:return null
To make it valid, you would need to return nothing:
funcdo_nothing()->void:pass
Or explicitly return nothing:
funcdo_nothing()->void:return
Become an Indie Gamedev with GDQuest!in GDSchool
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.