Skip to content

Instantly share code, notes, and snippets.

@seanstrom
Last active August 29, 2015 14:13
Show Gist options
  • Save seanstrom/58cec7219659e5ea2172 to your computer and use it in GitHub Desktop.
Save seanstrom/58cec7219659e5ea2172 to your computer and use it in GitHub Desktop.
Async JS/Node - Sync vs Async example
def greeter_sync
print(“Hello World”)
sleep(5000) # sleep for 5 seconds
print(“Goodbye World”)
end
def greeter_async
# sleep for 5 seconds, then print Goodbye World
async sleep(5000) then print(“Goodbye World”)
print(“Hello World”)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment