#If I have many for loop when I defining function, and I use return true.
16 messages · Page 1 of 1 (latest)
When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.
yes
please dont write one liners like that
its unreadable
your prof will also hate you
run an auto formatter over you code
and you will 100% not miss a point for style if that exists
I have use the auto formatter before
but I have to deal with many if statement
if I separate the if statement into many many lines , I cannot find out what I am doing
A return statement breaks out of the function that it is inside of, regardless of how many for loops, while loops, or if statements it is within
void flombigate() {
for (int x = 0; x < 10; x++) {
for (int y = 0; y < 10; y++) {
if (x + y > 10) {
return; //this will return from the *function* it's in, so it will return from "flombigate", and nothing else in flombigate will get run
}
}
}
}
This question thread is being automatically closed. If your question is not answered feel free to bump the post or re-ask. Take a look at !howto ask for tips on improving your question.