Loops
Baobab has two loops: pour … dans … iterates over an iterable (Python: for … in …), and tantque repeats while a condition stays true (Python: while).
12pour i dans intervalle(3):
afficher(i)0
1
2
intervalle(n) yields 0…n-1; intervalle(a, b) yields a…b-1. Inside a loop, casser exits immediately (Python: break) and continuer skips to the next iteration (continue).
1234n = 0
tantque n < 3:
afficher(n)
n = n + 10
1
2
A pour loop iterates just as well over an intervalle, a list, a string, or a dictionary's keys.