return
Leave the current function, optionally with a value.
Syntax
Section titled “Syntax”return;return expr;Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
expr | T | Must match the function return type when present. |
Return value
Section titled “Return value”Ends the function.
Luau emit
Section titled “Luau emit”return / return expr
Description
Section titled “Description”void functions use return;. Multiple return values use destructuring on the caller side, not return a, b in current CL++ style — return a table or a single value.
Example
Section titled “Example”const int DoubleCoins(int coins) { return coins;}Emits:
const function DoubleCoins(coins: number): number return coinsend