From 0fcf570a3fb143c787b25b5c4e5691b3f05930d6 Mon Sep 17 00:00:00 2001 From: Kodi Arfer Date: Thu, 18 Jul 2019 10:43:01 -0400 Subject: [PATCH] Document `await` --- docs/language/api.rst | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/docs/language/api.rst b/docs/language/api.rst index ca967a5..fd246a0 100644 --- a/docs/language/api.rst +++ b/docs/language/api.rst @@ -224,6 +224,23 @@ Examples of usage: .. note:: ``assoc`` modifies the datastructure in place and returns ``None``. +await +----- + +``await`` creates an :ref:`await expression `. It takes exactly one +argument: the object to wait for. + +:: + + => (import asyncio) + => (defn/a main [] + ... (print "hello") + ... (await (asyncio.sleep 1)) + ... (print "world")) + => (asyncio.run (main)) + hello + world + break -----