continue
cppreference.com
for, range-for, while do-while .
, , .
() continue ;
|
|||||||||
continue , goto, ( for, -for, while do-while).
,
while :
while (/* ... */) {
// ...
continue; // goto contin;
// ...
contin:;
}
do-while :
do {
// ...
continue; // goto contin;
// ...
contin:;
} while (/* ... */);
for (/* ... */) {
// ...
continue; // goto contin;
// ...
contin:;
}
#include <iostream>
int main()
{
for (int i = 0; i < 10; i++)
{
if (i != 5) continue;
std::cout << i << " "; // , i!=5
}
std::cout << '\n';
for (int j = 0; j < 2; j++)
{
for (int k = 0; k < 5; k++)
{
// continue
if (k == 3) continue;
// , k==3
std::cout << '(' << j << ',' << k << ") ";
}
}
}
:
5
(0,0) (0,1) (0,2) (0,4) (1,0) (1,1) (1,2) (1,4)
C continue
|