INPUT /  OUTPUT /  LANGUAGE






null tag

Category: ephemeral logic tag

Produces or tests for the value null.

Sample usage

<null> — produces the value null.

<null {}> — Tests the value {} and produces false since although an empty string is equal to null, it is not the null value itself.

Fields

Primary field

Category: vector field

Optional. The primary field may contain one or more values to test against.

Behavior

The null tag, when used without any field values, may be used to express the literal value null anywhere it is required.

When at least one primary field value is specified, the tag functions in a different way: it tests values for being exactly the value null.

This is different from using the eq tag to check if a value is 'equal' to null. Many values such as 0, false, or {} are evaluated as being equal to null, but the null tag tests for an exact match to the value null itself.

This is an important distinction. A value of null may mean input has not been provided, while a value of {} may mean the user has deliberately provided blank input. Explicitly testing for null allows your program to tell the difference.

Example

The following code displays a dialog box to prompt the user to enter their name. If the user enters a blank name, the code assigns {Player 1} as the user's name. However, if the user has entered a non-blank string of text, or simply cancelled the dialog box (indicated by an explicit null value), the value of the user's name is left unchanged.

<name:dialog text=true {Please enter your name:}>
<if <not|or name,<null name>> then=
    <name {Player 1}>
>

The condition in the above if tag can be deconstructed as follows: