سلم
Translation status: العربية reader-locale proof. Term names and code fences follow the ar pack; supporting prose may still be English.
Yields one value from a generator.
Aliases: yield
Syntax: سلم <expression>
Category#
async
Related#
Examples#
radix/corpus/cede/cede.fab (canonical · keyword)#
Yields one value from a generator.
# =============================================================================
# سلم — Yields one value from a generator.
# =============================================================================
#
# What this teaches:
# • Yield — `سلم <expression>` emits one item from a `مولد` or `مولد_غيرمتزامن`
# callable
# • Async values use `انتظر_ثابت`, `انتظر_متغير`, `أعد_منتظرا`, or `انتظر`; `سلم`
# is not an await form
#
# Common mistakes:
# • using `سلم` outside a generator body
#
# See also: cursor, مولد, مولد_غيرمتزامن
# =============================================================================
# سلم — yield from a stream function
#
# دالة stream() مولد → T { سلم value }
#
# GRAMMAR:
# yieldStmt :← 'سلم' 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]