The void data type typically indicates an invalid or missing value returned from a function or a variable with undefined values.
Voids will also appear when loading JSON files containing null values.
The following table lists few approaches how to obtain a void value intentionally.
| Method | Description |
|---|---|
| null() | Call the null function |
| Undefined array member | Create an array implicity, e.g. by assigning a[1] = 1; Read-accessing a[0] will return void |
| Reading JSON data | Intermediate nodes carry no values and are void. End nodes with value 'null' are also interpreted as void. |
Please try to use void values as little as possible in your B4P programs.
a[1] = 1;
echo( a[0] );
echo( null() );
echo( type(null()) );# Invalid Value #
# Invalid Value #
void