Skip to content

Modern Result Fail

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

Home › Result › Result › Fail

Fail

Returns a failed Result holding the reason; both types must be written out.

Syntax

Fail( of T, E )
Fail( of int32, ustring )

Examples

#import "std/outcome"
using outcome

dim r as Result( of int32, ustring ) = Fail( of int32, ustring )( "not a number" )

print r.IsOk( )              '' false
print r.Failure( )           '' not a number

'' T and E MAY BE THE SAME TYPE -- Result( of ustring, ustring ) is a normal
'' thing to want. The slots stay distinct because they are two fields,
'' not a union.

Library: Result
Category: Result
Documented under: Members

Clone this wiki locally