Renderingen-US

await_var

Translation status: English reader-locale proof. Term names and code fences follow the en pack; supporting prose may still be English.

Awaits a promise and binds a mutable name.

Aliases: await_var

Syntax: await_var T name ← future

Category#

async

Examples#

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

Awaits a promise and binds a mutable name.

# =============================================================================
# await_var — Await-bind mutable
# =============================================================================
#
# What this teaches:
#   • Await a `promise<T>` and bind the success value mutably.
#
# See also: await_const, await, async, promise
# =============================================================================

fn responde() async → int {
    return 3
}

async_main {
    await_var int responsum ← responde()
    responsum ← responsum + 1
    print responsum
}

Expected output:

4