การเรนเดอร์th-TH

สตรีม

Translation status: ภาษาไทย reader-locale proof. Term names and code fences follow the th-TH pack; supporting prose may still be English.

Callable posture for synchronous stream (generator) functions.

Aliases: generator

Syntax: ฟังก์ชัน name(…) สตรีม → T

Category#

async

Examples#

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

Callable posture for synchronous stream (generator) functions.

# =============================================================================
# สตรีม — Synchronous stream callable posture
# =============================================================================
#
# What this teaches:
#   • Preferred stream posture: `สตรีม → T` yields `T` items.
#   • Yield with statement-initial `ให้ value` inside the body.
#
# Common mistakes:
#   • Using `@ เคอร์เซอร์` only when teaching preferred morphology — prefer `สตรีม`.
#
# See also: เคอร์เซอร์, ให้, สตรีมอะซิงก์
# =============================================================================

# GRAMMAR:
#   callablePosture :← 'สตรีม'
#   yieldStmt :← 'ให้' expr
#
# EXPECTED OUTPUT:
#   [1, 2]

ฟังก์ชัน stream() สตรีม → จํานวน {
    ให้ 1
    ให้ 2
}

เริ่ม {
    บันทึก stream()
}

Expected output:

[1, 2]