Saw this in a solved excercise. Isn't the while loop already a conditional? Is it better to use both the if block and the while loop even if I don't need a else statement afterwords?
int main(void) {
int foo = 10;
if (!foo) {
while (!foo) {
foo--;
}
}
return 0;
}
I would write that code this way:
int main(void) {
int foo = 10;
while (!foo) {
foo--;
}
return 0;
}
Aucun commentaire:
Enregistrer un commentaire