Loop

There IS a semi-colon after do-while statement: do{}while();

do{

}while(1); //<- while( );

break; exit from the innermost loop / switch statement

continue; skip the remaining statements of current iteration, and continue the next step (conditional statement / iteration)

comma operator , evaluate all sub-exprs and return the value of the rightmost one

Hint: use relational expr (>, <) rather than equality expr to avoid infinite loop

DO NOT USE Float in loop

for (int i = 0; //  Initialization Statements
    i<100; // Exit Condition
    i++){

} // No semi-colon here
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容