Last active
August 29, 2015 14:13
-
-
Save seanstrom/58cec7219659e5ea2172 to your computer and use it in GitHub Desktop.
Async JS/Node - Sync vs Async example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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