Renderingen-US

await_const

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 an immutable name.

Aliases: await_const

Syntax: await_const T name ← future

Category#

async

Examples#

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

Awaits a promise and binds an immutable name.

# =============================================================================
# await_const — Await-bind immutable
# =============================================================================
#
# What this teaches:
#   • Await a `promise<T>` and bind the success value immutably.
#   • Valid in `async` / `async_generator` / `async_main` contexts.
#
# See also: await_var, await, return_await, async, promise
# =============================================================================

# GRAMMAR:
#   awaitBind :← 'await_const' type? IDENT '←' expr

fn responde() async → int {
    return 7
}

async_main {
    await_const int responsum ← responde()
    print responsum
}

Expected output:

7