在下面的代码中,请查看具有"continue"语句的部分.如果我删除'continue'语句并且我没有放任何代替它会有什么不同.
int prime_or_not(int x){
int i;
if (x == 1 || x == 2){
return 1;
}else if (x % 2 == 0){
return 0;
}else if (x > 2){
for (i = 3; i < x; i += 2){
if (x % i == 0){
return 0;
break;
}else {
continue;
}
}
return 1;
}else {
return 0;
}
}
Run Code Online (Sandbox Code Playgroud)
它对您的代码没有任何影响,但请考虑这样的事情:
(伪代码):
for(int i = 10; i > -5; i--) {
if(i == 0)
continue;
printf("%d", 10/i);
}
Run Code Online (Sandbox Code Playgroud)