रेंडरिंगhi

cede

Translation status: हिन्दी reader-locale proof. Code fences render through the hi pipeline; prose is canonical Latin.

Yields one value from a generator.

Aliases: yield

Syntax: cede <expression>

Category#

async

Examples#

radix/corpus/cede/cede.fab (canonical · keyword)#

Yields one value from a generator.

# =============================================================================
# cede — Yields one value from a generator.
# =============================================================================
#
# What this teaches:
#   • Yield — `cede <expression>` emits one item from a `fiunt` or `fient`
#     callable
#   • Async values use `figendum`, `variandum`, `reddet`, or `tacebit`; `cede`
#     is not an await form
#
# Common mistakes:
#   • using `cede` outside a generator body
#
# See also: cursor, fiunt, fient
# =============================================================================

# cede — yield from a stream function
#
# functio stream() fiunt → T { cede value }
#
# GRAMMAR:
#   yieldStmt :← 'cede' expr
#
# EXPECTED OUTPUT:
#   [1, 2]
#
# BACKEND:
#   Cursor stream materialization smoke.

fn stream() generator  int {
    yield 1
    yield 2
}

main {
    print stream()
}

Expected output:

[1, 2]