HasValue Procedure

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


Return value

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


This example shows how HasValue responds to changes in an Optional Number variable.
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"
HasValue is initially false
HasValue is now true
HasValue is false again