for(int i = 0; i < 10; i++){
if(i == 0) break;
DoSomeThing(i);
}
for(int i = 0; i < 10; i++){
if(i == 0) continue;
DoSomeThing(i);
}
From above code is simple to explain
break is complete stop and exit loop
continue use to stop current loop but can continue to next loop
ไม่มีความคิดเห็น:
แสดงความคิดเห็น