Skip to content

Modern Result Value

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

Home › Result › Result › Value

Value

Returns the value by reference; raises an error if the Result failed.

Syntax

Value( ) byref as T

Examples

#import "std/outcome"
using outcome

dim r as Result( of int32, ustring ) = Ok( of int32, ustring )( 42 )

print r.Value( )             '' 42

'' Value( ) returns BYREF, so it assigns in place
r.Value( ) = 43
print r.Value( )             '' 43

'' On a FAILED Result this raises FB_RTERROR_ILLEGALFUNCTIONCALL --
'' catchable by `on error`, and a bug at the call site otherwise.
'' Guard with IsOk( ), or use ValueOr( ).

Library: Result
Category: Result
Documented under: Members

Clone this wiki locally