From Xojo Documentation
Used to determine if an object is nil (no value).
expression = Nil
Nil means no value. When an object is first instantiated, it is automatically initialized to Nil. Some functions will return a Nil value under certain circumstances. GetOpenFolderItem will return Nil if the user clicks the Cancel button when GetOpenFolderItem presents the standard open file dialog box.
Nil is a constant of its own datatype, not an Object. It can convert itself to any object class, any array type, or any of the pointer types (Ptr, WindowPtr, CString, PString, WString, and CFStringRef).
You can pass Nil for any of the string parameter types above (CString, PString, WString), but not for String. Passing Nil is not the same as passing the empty string, "". Passing Nil means you want to pass a null pointer. Passing "" means you want to pass a non-null pointer to the representation of "" for the declared format.
If you try to access an object that has a Nil value, a NilObjectException error will be generated. If you don't handle the exception, execution will stop. If you are testing the application in the IDE, you can choose Project ↠ Break on Exceptions to halt execution whenever a runtime exception error occurs and open the Debugger.
If the code executes in a built application, the user will see a generic error message before the application quits.
This example uses Nil to determine if the user clicked the Cancel button in the standard open file dialog box presented by the GetOpenFolderItem function.
d.Value("Name") = "Mary"
Catch err As NilObjectException
ErrorLabel.Text = err.Message