Value Procedure

If an Optional contains a value, then it is returned. If not, an error is thrown. Use HasValue first to determine whether a value is present before calling Value.
Declaration
function Value(this as Optional T) as T

Parameters

Return value

The value contained in this.

Example

This example program shows how to use HasValue and Value together.
Code
sub PrintIfPresent(x as Optional String)
if HasValue(x) then
print Value(x)
else
print "no value"
end if
end sub
sub Main()
dim missing as Optional String
PrintIfPresent "hello"
PrintIfPresent missing
end sub
Output
hello
no value