Try-Statements
Try-statement syntax
--OR--
The try-statement will evaluate the expression in-between try
and with
. Said expression must have a type of (..., error)
.
If
error != nil
: the expression to the right ofwith
will be returned.If
error == nil
:If you're using the first syntax: Control flow will continue as normal
If you're using the second syntax: expression between
try
andwith
will be destructured intosuccessVar
andfailureVar
Working Example
Last updated