V
Vinayakan Kuruvath
Hi,
#include <stdio.h>
int main() {
int i=0;
do {
i++;
printf("Before continue --> i: %d\n", i);
if ( i == 7) continue;
printf("After continue --> i: %d\n", i);
} while (i < 10);
printf("Over\n");
}
In the above code, if I remove the semi-colon after the 'while (i< 10)' the parser will complain.
I am just curious as to why a 'do ... while' loop syntax needs a semicolon at the end.
Whereas for and while loop do not need a semi-colon terminator at end.
Regards,
Vinayakan.
#include <stdio.h>
int main() {
int i=0;
do {
i++;
printf("Before continue --> i: %d\n", i);
if ( i == 7) continue;
printf("After continue --> i: %d\n", i);
} while (i < 10);
printf("Over\n");
}
In the above code, if I remove the semi-colon after the 'while (i< 10)' the parser will complain.
I am just curious as to why a 'do ... while' loop syntax needs a semicolon at the end.
Whereas for and while loop do not need a semi-colon terminator at end.
Regards,
Vinayakan.