Boomla language docs
Yield statement
+
Overview
Types
Nil type
Boolean type
Numeric types
String type
Array type
Map type
Struct type
Function type
File type
Bucket type
Reference types
Box type
Expressions
Operators
Get expressions
Index expressions
Slice expressions
Grouping
Literals
Instantiations
Identifiers
Call expressions
Xml expressions
Function literals
As expressions
Statements
Import statement
Type declarations
Var declarations
Function declarations
Method declarations
Assign statement
If statement
For statement
Assert statement
Return statement
Fail statement
Panic statement
Yield statement
Break statement
Continue statement
Defer statement
IncDec statement
Expression statement
Block statement
Yield statement
The yield statement terminates the execution of a yield block with a result value.
Yield blocks are assign statement bodies and error handler bodies.
Assert yields default value on type mismatch.
fn main() { var name string|nil assert name is string else { yield "anonymous" } println("hello ${name}") }
Run
Yield from error handler.
import "errors" fn findUserName() (s string) (err error) { fail errors.New("network timeout") } fn main() { name := findUserName() err { yield "user" // Use default value } println("hello ${name}") }
Run