Async functions and await
Calling an async fn creates a lazy Future<T>. await starts it if needed, suspends the current task, and produces its T; only async functions may await.
async fn main() is the one entry whose future the launcher drives automatically. There is no synchronous helper that blocks on a future.
async fn answer() -> int {
await sleep(5)
42
}
async fn main() {
println(await answer())
}
Examples use the moon toolchain version shown beside each result.
Output & diagnostics
Expected: 42
Ctrl/⌘+Enter runs the current lesson.