渲染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 binds a mutable name.

Aliases: await_var

Syntax: 等变 T name ← future

Category#

async

Examples#

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

Awaits a 期约 and binds a mutable name.

# =============================================================================
# 等变 — Await-bind mutable
# =============================================================================
#
# What this teaches:
#   • Await a `期约<T>` and bind the success value mutably.
#
# See also: 等定, 等弃, 异步, 期约
# =============================================================================

函数 responde() 异步 → 整数 {
    返回 3
}

异步入口 {
    等变 整数 responsum ← responde()
    responsum ← responsum + 1
    显示 responsum
}

Expected output:

4