Lesson 4 / 14
pe and mentre che
pe (tien i = 1; i <= 3; i++) { … } repeats the block while counting (for).
mentre che (condition) { … } repeats as long as the condition is true (while). Careful not to write a loop that never ends: the playground stops it after a short while.
Exercise
Make the first loop count from 1 to 5, and remove the second loop.
pe (tien i = 1; i <= 3; i++) {
stamm a dì(i)
}
tien pizze = 2
mentre che (pizze > 0) {
stamm a dì("Ne manca", pizze)
pizze--
}
When you are done, the program prints
1
2
3
4
5