Is a For Loop always executed at least once?

前端 未结 4 1809
栀梦
栀梦 2021-02-20 01:32

According to my teacher, a for-loop always executes at least once, even if the condition is not met.

Example (like I know it from C++):

for (int i=6; i &         


        
4条回答
  •  悲&欢浪女
    2021-02-20 02:00

    An entry controlled loop will never execute if the condition is false, however, exit controlled loop will execute at least once.

提交回复
热议问题