อ่าน
Translation status: ภาษาไทย reader-locale proof. Term names and code fences follow the th-TH pack; supporting prose may still be English.
Reads input from the active input stream.
Syntax: อ่าน [บรรทัด]
Category#
io
Related#
Examples#
radix/corpus/lege/lege.fab (canonical · keyword)#
Reads input from the active input stream.
# =============================================================================
# อ่าน — Reads input from the active input stream.
# =============================================================================
#
# What this teaches:
# • stdin input with `อ่าน` — reads one line from the active input stream
# • the `↦ regex` แปลง — compiling a ข้อความ pattern into a regex value
#
# Common mistakes:
# • Not checking is null before using the value — read may return null at end of input.
#
# See also: บรรทัด, เขียน
# =============================================================================
# อ่าน and regex การแปลง — I/O read and compiled pattern expressions
#
# คงที่ _ pattern ← "\d+" ↦ regex -- compiled regex from ข้อความ
# คงที่ _ input ← อ่าน -- stdin line read
#
# GRAMMAR:
# การแปลง :← stringLit '↦' 'regex'
# readExpr :← 'อ่าน'
#
# EXPECTED OUTPUT:
# Regex pattern diagnostic, then one stdin line (no .expected — interactive).
#
# BACKEND: Rust/Go/roundtrip e2e whitelist — อ่าน not yet lowered for Rust/Go
# (whitelist: อ่าน/lege.fab).
main {
const regex pattern ← "(?i)\d+" ↦ regex
print pattern
const string ∪ none input ← read
print input
}