Yield Statement

A yield statement is used to return a value from an expression. Similar to return, as code below yield will not be executed.

Yield can be used in the following expressions:

Structure

YieldStmt = 'yield' Expression

Example

yield 5
yield x

References