
ALT # Executing async functions: synchronous start, asynchronous settlement Async functions are executed as follows: 1. The Promise `p` for the result is created when the async function is started. 2. Then the body is executed. There are two ways in which execution can leave the body: 2.1. Execution can leave **permanently** while settling `p`: 2.1.1. A `return` fulfills `p`. 2.1.2. A `throw` rejects `p`. 2.2. Execution can also leave **temporarily** when awaiting the settlement of another Promise `q` via `await`. The async function is paused and execution leaves it. It is resumed once `q` is settled. 3. Promise `p` is returned after execution has left the body for the first time (permanently or temporarily). Note that the notification of the settlement of the result `p` happens asynchronously, as is always the case with Promises.

























