Stop at the first over fifty · Arrêtez au premier dépassement de cinquante
Stop at the first over fifty
n starts at 1. Keep adding 1 to it. As soon as n * n is more than 50, leave the loop with break. Print n afterwards.
break leaves the loop at once. ⚠️ It only works inside the loop, so the if that holds it must be indented under the while too — and the break indented once more, under the if. print(n) stays at the left, outside the loop, so it runs after the break.
S'arrêter au premier supérieur à cinquante
n commence à 1. Continuez à ajouter 1 à elle. Dès que n * n est plus grand que 50, quittez la boucle avec break. Imprimez n après.
break quitte la boucle immédiatement. ⚠️ Il ne fonctionne qu'à l'intérieur de la boucle, donc la if qui la contient doit être indentée sous le while aussi — et la break indentée une fois de plus, sous le if. print(n) reste à gauche, hors de la boucle, donc elle s'exécute après le break.
n starts at 1. Keep adding 1 to it. As soon as n * n is more than 50, leave the loop with break. Print n afterwards. · n commence à 1. Continuez à ajouter 1 à elle. Dès que n * n est plus grand que 50, quittez la boucle avec break. Imprimez n après.
Click Run to see the output here. · Cliquez sur Exécuter pour voir le résultat ici.