Skip to content

Modern Optional Some

Paul Squires edited this page Oct 19, 2026 · 5 revisions

Home › Optional › Optional › Some

Some

Returns an Optional holding the value, its type taken from the argument.

Syntax

Some( v ) as Optional( of T )

Examples

#import "std/outcome"
using outcome

dim o as Optional( of integer ) = Some( 42 )

print o.HasValue( )          '' true
print o.Value( )             '' 42

'' T is inferred FROM THE ARGUMENT, so `of T` need not be written --
'' unlike None( ), which has no argument to infer from.
'' Mind what the literal infers AS: 42 is an INTEGER, so
'' `dim o as Optional( of long ) = Some( 42 )` is error 24. Declare the
'' matching type, or pass a variable of the type you want.

Library: Optional
Category: Optional
Documented under: Members

Clone this wiki locally