criteria to use a while-loop

12 visualizaciones (últimos 30 días)
G L
G L el 11 de Jun. de 2020
Editada: madhan ravi el 11 de Jun. de 2020
I want to compare the difference between a for-loop and a while-loop.
What are criteria to use a while-loop?

Respuestas (2)

madhan ravi
madhan ravi el 11 de Jun. de 2020
Editada: madhan ravi el 11 de Jun. de 2020

the cyclist
the cyclist el 11 de Jun. de 2020
As a general rule, you will use a for loop when you know ahead of time how many iterations you want, and a while loop when you don't, but instead base the number of iterations on some condition that will get triggered during the loop itself.

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by