Lesson 7 / 14
Lists
A list is written between square brackets: ["margherita", "marinara"]. lista[0] is the first element, lista.length how many there are.
pe ogni (chist è x dint lista) { … } goes through the elements one by one (for…of).
All JavaScript methods work: map, filter, join, toUpperCase…
Exercise
Print each pizza in upper case (pizza.toUpperCase()), one per line, with no other lines.
chist è pizze = ["margherita", "marinara", "diavola"]
stamm a dì(pizze.length, "pizze")
stamm a dì(pizze[0])
pe ogni (chist è pizza dint pizze) {
stamm a dì("-", pizza)
}
When you are done, the program prints
MARGHERITA
MARINARA
DIAVOLA