渲染zh-Hant

等返

Translation status: 繁體中文 reader-locale proof. Term names and code fences follow the zh-Hant pack; supporting prose may still be English.

Awaits a 承諾 and returns its success value from a 異步 body.

Aliases: return_await

Syntax: 等返 future

Category#

async

Examples#

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

Awaits a 承諾 and returns its success value from a 異步 body.

# =============================================================================
# 等返 — Await-return
# =============================================================================
#
# What this teaches:
#   • Await and return from a `異步` function only (`等返 future`).
#
# See also: 等定, 等棄, 異步, 傳回
# =============================================================================

函式 interior() 異步 → 整數 {
    傳回 9
}

函式 exterior() 異步 → 整數 {
    等返 interior()
}

非同步入口 {
    等定 整數 v ← exterior()
    註記 v
}

Expected output:

9