FratmScript 🤌🏻

Lesson 6 / 14

Arrows and templates

For a short function there is the arrow: chist è doppio = n => n * 2. With more parameters: (a, b) => a + b.

A string between backticks (` `) is a template: everything inside ${…}` is computed and put into the text.

Exercise

With an arrow prezzo = n => n * 6 and a template, print "3 pizze costano 18 euro".

chist è doppio = n => n * 2
chist è nome = "Totò"

stamm a dì(`${nome} vo' ${doppio(2)} sfogliatelle`)

When you are done, the program prints

3 pizze costano 18 euro

Do this lesson in the playground