渲染zh-Hans

等返

Translation status: 简体中文 reader-locale proof. Term names and code fences follow the zh-Hans 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