Skip to content

Instantly share code, notes, and snippets.

@Varriount
Created March 26, 2020 23:51
Show Gist options
  • Save Varriount/ceb2675686d9ed1c008017dabf81a5ae to your computer and use it in GitHub Desktop.
Save Varriount/ceb2675686d9ed1c008017dabf81a5ae to your computer and use it in GitHub Desktop.
async proc foo(i: int) int =
await bar(i) // gives i+1
await bar(i+1) // gives i+2
await bar(i+2) // gives i+3
# To
proc foo(state: var State) =
if state.state == 1:
state.waiting_on = bar(state.bar_state, state.i)
if state.state == 2:
state.waiting_on = bar(state.bar_state, state.i + 2)
if state.state == 3:
state.waiting_on = bar(state.bar_state, state.i + 3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment