Learn about difference between continue and break in c, we have the largest and most updated difference between continue and break in c information on alibabacloud.com
Almost all programming languages have break and continue statements, which can be seen as important, even if it's unimportant. But in the real development process, how many people will ignore their usage? People who believe in beginners or who don't
This article reproduced: http://blog.chinaunix.net/uid-26715658-id-3254915.htmlBreak and Continue use the same range, both can be used for loops, and the break in It can also be used for switch. function also has certain similarity, break is
Today, while reviewing Java, I found a Java break statement and a continue statement and a c++/c language inside a little different.
First, let's introduce the break and Continue statements :
Both break and continue statements can skip part of the
1. Difference Between break and continue:
Break: jumps out of the loop and runs down.
Continue: Terminate this loop and perform the next loop.
For example:
For (INT I = 0; I
{
If (I = 0)
{
Break;
// Continue;
}
Printf
Delphi indicates that there are break,continue,abort,exit,halt,runerror, etc.1.breakForce the exit of the most recent loop (note: It can only be placed in a loop, and it can only jump out of the last layer of the loop ), and is used to force exit
Return is the function that exits the loop body, which is equivalent to ending the method.
The function of break is to end the loop, jump out of the loop body, and execute the subsequent program.
The role of continue is to end the cycle and
The program that looks at the following switch statement first:scanf ("%d", &score);if (score>=0 && scoreSwitch (SCORE/10) {Case 10:Case 9:Grade = ' A ';BreakCase 8:Grade = ' B ';BreakCase 7:Grade = ' C ';BreakCase 6:Grade = ' D ';BreakDefaultGrade =
The person who thinks the C language is still a beginner seems to overestimate himself. I didn't think there was such an interesting thing in this place. Some words seem to be carefully studied to really get started ah ....
=========================
the difference between the Break,continue,returnThese 3 keywords have been used recently, so I'd like to summarize his usage.
1 break directly out of the current loop, starting from outside the current loop, ignoring any other statements in the
Loop structure----------------------------1--structureLoops1.1 While Loop1.2 Do..... While loop 1.3 for Loop--2--break and Continue2.1The break keyword2.2ContinueKey Words
--------------------------"Write at the beginning:"『
The
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.