Asynchronous Functions
Asynchronous functions synchronise with each other. They take turns running lines of code.
async funct count() {
print(2)!
print(4)!
}
count()!
print(1)!
print(3)!
print(5)!
You can use the noop keyword to wait for longer before taking your turn.
async func count() {
print(2)!
noop!
print(5)!
}
count()!
print(1)!
print(3)!
print(4)!
Note: In the program above, the computer interprets noop as a string and its sole purpose is to take up an extra line. You can use any string you want.
Asynchronous Functions
Asynchronous functions synchronise with each other. They take turns running lines of code.
You can use the
noopkeyword to wait for longer before taking your turn.Note: In the program above, the computer interprets
noopas a string and its sole purpose is to take up an extra line. You can use any string you want.