"Null" (编译类型)
"Null"
represents a type to indicate the absence of a result.
更多信息
- "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.
范例
基本范例 (2)
"Null" can be used as an output from a CompiledCodeFunction:
Call the function that prints a string and returns a "Null" result:
The Null symbol can be seen with InputForm:
A function that assigns to a raw pointer can return Null to indicate that it is changing the state of an argument:
Generate a raw pointer to an integer:
Call the compiled function with the unmanaged value; it returns Null:
技术笔记
相关指南
历史
2025年引入 (14.3)