criteria to use a while-loop

12 ビュー (過去 30 日間)
G L
G L 2020 年 6 月 11 日
編集済み: madhan ravi 2020 年 6 月 11 日
I want to compare the difference between a for-loop and a while-loop.
What are criteria to use a while-loop?

回答 (2 件)

madhan ravi
madhan ravi 2020 年 6 月 11 日
編集済み: madhan ravi 2020 年 6 月 11 日

the cyclist
the cyclist 2020 年 6 月 11 日
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.

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by