Skip to content

Modern Result Result

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

Home › Result › Result › Result

Result

Holds either a value or the reason it could not be made; a new one counts as failed.

Syntax

Result( of T, E )
Result( of ustring, ustring )

Notes

  • "nothing is here, AND this is why"

Examples

#import "std/outcome"
using outcome

'' A value, or the reason there isn't one. The difference from Optional
'' is the E: Optional says "nothing is here", Result says "nothing is
'' here, AND this is why".
dim r as Result( of int32, ustring )

'' A DEFAULT-CONSTRUCTED RESULT IS A FAILURE. That is deliberate: a
'' Result nobody has set must not read as success, or every forgotten
'' assignment becomes a silent Ok.
print r.IsOk( )              '' false

r = Ok( of int32, ustring )( 42 )
print r.IsOk( )              '' true
print r.Value( )             '' 42

Library: Result
Category: Result
Documented under: Result Or Optional?

Clone this wiki locally