Kết xuấtvi

sinh

Translation status: Tiếng Việt reader-locale proof. Term names and code fences follow the vi pack; supporting prose may still be English.

Callable posture for synchronous stream (generator) functions.

Aliases: generator

Syntax: hàm name(…) sinh → T

Category#

async

Examples#

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

Callable posture for synchronous stream (generator) functions.

# =============================================================================
# sinh — Synchronous stream callable posture
# =============================================================================
#
# What this teaches:
#   • Preferred stream posture: `sinh → T` yields `T` items.
#   • Yield with statement-initial `nhường value` inside the body.
#
# Common mistakes:
#   • Using `@ con_trỏ` only when teaching preferred morphology — prefer `sinh`.
#
# See also: con_trỏ, nhường, async_sinh
# =============================================================================

# GRAMMAR:
#   callablePosture :← 'sinh'
#   yieldStmt :← 'nhường' expr
#
# EXPECTED OUTPUT:
#   [1, 2]

hàm stream() sinh → số {
    nhường 1
    nhường 2
}

bắt_đầu {
    ghi_chú stream()
}

Expected output:

[1, 2]