"Null" (Compiled Type)
"Null" (Compiled Type)
"Null"
represents a type to indicate the absence of a result.
Details
- "Null" can be used in Typed and related constructs to specify a type.
- Terminating code with a semicolon such as expr; is a typical way to return "Null" from a function.
- Functions that return "Null" do not return anything useful but typically change the state of a program.
Properties
- The only value held by "Null" comes from compilation of the symbol expression Null.
Examples
Basic Examples (2)
"Null" can be used as an output from a CompiledCodeFunction:
cf = FunctionCompile[Function[{}, Print["inside"];]]Call the function that prints a string and returns a "Null" result:
cf[ ]The Null symbol can be seen with InputForm:
cf[ ]//InputFormA function that assigns to a raw pointer can return Null to indicate that it is changing the state of an argument:
cf = FunctionCompile[Function[{Typed[rp, "RawPointer"::["Integer64"]]}, ToRawPointer[rp, 101];]]Information[cf, "ReturnType"]Generate a raw pointer to an integer:
rp = RawMemoryAllocate["Integer64"]Call the compiled function with the unmanaged value; it returns Null:
cf[rp["Value"]]The integer stored in the raw pointer has been set:
RawMemoryRead[rp]See Also
True False Typed TypeSpecifier FunctionCompile
Compiled Types: Integer64 Real64 ComplexReal64
Tech Notes
Related Guides
History
Introduced in 2025 (14.3)