Skip to content

Function

Narta Xaymar Dirks edited this page Oct 28, 2026 · 3 revisions

Blitz3DBlitzPlusBlitzBasic

Function

Function Name[type]([In|Out|InOut] parameter[type][= default], ...)
statements
End Function

Description

Declares a function. A type character after the name (%, #, $) or a long type (Name:Float) sets what it returns, and parameters are typed the same way. A parameter with = value is optional and gets that value when the call leaves it out. Return leaves the function, with a value when it has a return type. A parameter is passed by value (In, the default); writing Out or InOut in front of its name makes the function hand its value back to the variable the caller passed, see Parameter modes. Functions can only be declared outside of other code, they may call each other in any order, and they end with End Function. Variables made inside are local to the function; use Global for variables that every function sees.

Examples

Function Area#(w#, h# = 2.0)
	Return w * h
End Function

Print Area(3, 4)
Print Area(5)
12.0
10.0

Related Commands

EndFunction, Gosub, Goto

Home · Command Index



Differences
Language Features
BlitzBasic
Blitz3D
BlitzPlus

Clone this wiki locally