Void

:This article is about a return data type. For the Lua type that may also be called "void", see nil. For the parts destroy height, see .
void is a data type used by the engine's API reference as the return type of a function to indicate that no value is returned. For example, passing the result value of to the type function will result in an error since the result value is absent.
:
local part = Instance.new("Part")
print(type(part:FindFirstChild("Brick"))) -- nil
print(type(part:Destroy())) -- missing argument #1
However, void evaluates to nil when assigned to a variable or used with operators.
:
local part = Instance.new("Part")
print(part:Destroy() == nil) -- true
local result = Instance.new("Part"):Destroy()
print(type(result)) -- nil
void is derived from the C++ void type, where a function that reaches its end or returns with no values has a void result type. In Luau, the syntax () (a representation of no result values enclosed in parentheses) is used as a type annotation of a function that returns no values, similar to the void type.
:
local function a() : ()
 print("Hello world!")
end
type(a()) -- missing argument #1
==External links==
*void on the Roblox API Reference
Category:API types