Bifalgorithm post · Computer science one · For Loops

What happens when a while loop never increments its counter?

What happens when a while loop never increments its counter? (Computer science one · For Loops) — "In the while loop, we never increment the counter variable $…

Ideas in this flowchart

  • Un while sans incrémentation de $i ne fonctionne pas comme prévu
  • La variable compteur $i n'est jamais incrémentée
  • La boucle ne fait rien
  • Le calcul continue indéfiniment
  • Le code est valide en PHP et s'exécute
  • Le comportement obtenu ne correspond évidemment pas à l'intention
  • Il faut utiliser une syntaxe appropriée pour éviter ce problème
Feed/

What happens when a while loop never increments its counter?

No cover

Channel

Computer science one

1 page

"In the while loop, we never increment the counter variable $i, the loop does nothing, and so the computation will continue on forever! It is valid PHP and will run, but obviously won’t work as intended. Avoid this problem by using proper syntax."

Flowchart preview
👍
0
0 comments0 shares

Sign in to view and post comments.