Null type

This feature is available from version 5.4.9.

In this topic:

Description

The Null was introduce in AskiaScript to manage the communication with third-party system (like a JSON Web Service) that uses it.
In regular AskiaScript usage, the Null value/type is not intended to be used.

To make sure the usage of the Null remain limited, we decide to treat it as full type by itself.
The value of this type is always the same Null.

 

Because the Null is a type of variable (with a unique value), once a variable is assigned to null, his value could not be changed.

Dim myValue = null
myValue.TypeOf() ' => "null"

myValue = 1 '=> COULD NOT WORK, because the type is different

 

Because the Null is a type of variable, it could not be assigned to another type of variable, except the Variant (as many AskiaScript type)

Dim myValue As String
myValue = Null ' => COULD NOT WORK, because the type is different

Dim myValue As Variant
myValue = Null ' => This one works

Creation

Assign a Null value to a variable.


Dim valueA = Null

 

Methods

ToString()

Always returns "null"

Return a String

dim MyVariable = Null
MyVariable.ToString() ' => "null"

 

↑ Top of page ↑

TypeOf()

Always returns "null"

Return a String

dim MyVariable = Null
MyVariable.TypeOf() ' => "null"

 

↑ Top of page ↑

Operators

Name Symbol / Expression Description Example
Equal = Test if the type (or value) of the variable is null
Returns a boolean
dim i as variant
(i = null) ' => True Because the value of j is not defined
Different <> Test if the type (or value) of the variable is not null
Returns a boolean
dim i as variant
(i <> null) ' => False Because the value of j is not defined

 

↑ Top of page ↑

Create your own Knowledge Base