FratmScript 馃馃徎

Lesson 11 / 14

mo vir and aspett

mo vir facc creates an asynchronous function (async): it can wait for things that take time, like a network request.

aspett promise waits for a Promise to finish (await). Here aspetta(500) waits half a second.

Exercise

After the aspett, print "Pronta!".

chist 猫 aspetta = ms => nu bell Promise(risolvi => setTimeout(risolvi, ms))

mo vir facc cucina() {
    stamm a d矛("Metto 'a pizza dint'o furno...")
    aspett aspetta(500)
}

cucina()

When you are done, the program prints

Metto 'a pizza dint'o furno...
Pronta!

Do this lesson in the playground