Kết xuấtvi

async

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 asynchronous finite functions.

Aliases: async

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

Category#

async

Examples#

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

Callable posture for asynchronous finite functions.

# =============================================================================
# async — Asynchronous finite callable posture
# =============================================================================
#
# What this teaches:
#   • Preferred async posture word after the parameter list: `async → T`.
#   • Return type is observed as `lời_hứa<T>` at call sites.
#   • Consume with `đợi_hằng`, `đợi_biến`, `đợi_trả`, or `đợi_bỏ`.
#
# Common mistakes:
#   • Using bare `nhường` to await — await is not yield; use await morphology.
#
# See also: tương_lai, lời_hứa, đợi_hằng, đợi_bỏ
# =============================================================================

# GRAMMAR:
#   callablePosture :← 'async'
#
# EXPECTED OUTPUT:
#   42

hàm responde() async → số {
    trả 42
}

bắt_đầu_bất_đồng_bộ {
    đợi_hằng _ responsum ← responde()
    ghi_chú responsum
}

Expected output:

42