Language Reference

Async and await

Define asynchronous functions and await results using natural language.

Async checklist

  • Use create an async function.
  • Await inside async functions.
  • Combine with loops carefully.

Async function definitions

Declare async functions using a readable sentence that maps to Python async def.

async.pln
create an async function named fetch_data that takes url and returns await requests.get(url)

Awaiting in blocks

Inside async functions, you can await inside loops or conditions.

awaits.pln
create an async function named process_items that takes items and does
    for each item in items do
        result = await process_item(item)
        print result

Async guidance

  • Only use await inside async functions.
  • Wrap network calls to keep flows readable.
  • Use async endpoints for high concurrency APIs.