Default Values

When you declare a variable and do not initialize it, the compiler gives it a default value. For value types, the default value is different for each type. For reference types, the default value is #Null. See Value Types and Reference Types for more information.

Default property

All value types that are part of the language have a shared property (Default) that returns the default value for its related type.

Data TypeDefault Value
Boolean.DefaultBoolean.False
Char.Default%NUL
DateTime.Default@0000-00-00@00:00:00
Fixed64.Default and Fixed128.Default@0.0
Int.Default and related0
Real.Default and related0.0
String.Default""
UInt.Default and related0

#Null

#Null is the value for an object that was not initialized. It is used to give an indication that an object is available for garbage collection, and to know if an object was initialized.

The pipe character (|) is an alternative syntax to #Null. You can use it when #Null shows a separation in a list, such as a parameter list or in the statement New. You can write one or more hyphens (-) after the pipe character to help you see it when it is the only expression in a line. This can occur with the block construct of New.

In the example that follows, the two statements are equivalent.

Menu #file, "&File", _
   "&Open", OpenFile, |, "E&xit", ExitProgram

New Menu #file, "&File"
Begin
   "&Open", OpenFile
   |----
   "E&xit", ExitProgram
End Menu

See also