HasValue Procedure

Determines whether an Optional contains a value of the underlying type, or whether it is none.
Declaration
function HasValue(this as Optional T) as Boolean

Parameters

Return value

Boolean — If this contains a value (of type T), then HasValue returns true. Otherwise, it returns false.

Example

This example shows how HasValue responds to changes in an Optional Number variable.
Code
dim x as Optional Number
if not HasValue(x) then print "HasValue is initially false"
let x = 123
if HasValue(x) then print "HasValue is now true"
let x = none
if not HasValue(x) then Print "HasValue is false again"
Output
HasValue is initially false
HasValue is now true
HasValue is false again