null

Summary

A value intentionally indicating no value for the data.

Syntax

null

Description

null intentionally indicates that there is no value for the data.

The expression null has its own type: null.

By default, JS++ types are not nullable. In order to assign the null value, use nullable types:

1
2
3
4
5
int x = 1;  // not nullable
int? y = 1; // nullable
 
// x = null; // error
y = null;    // ok

Examples

Basic Usage
1
int? x = null;
Assign null to represent "no data"
1
2
3
4
5
import System;
 
class Pet {}
 
Pet? pet = null;

See Also

Share

HTML | BBCode | Direct Link