When running a for loop is there any way to make it restart the function. Kind of like a return command.

At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.

Get our expert's

answer on brainly

SEE EXPERT ANSWER

Get your free account and access expert answers to this and thousands of other questions.

A community for students.

When running a for loop is there any way to make it restart the function. Kind of like a return command.

MIT 6.00 Intro Computer Science (OCW)
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.

Get this expert

answer on brainly

SEE EXPERT ANSWER

Get your free account and access expert answers to this and thousands of other questions

I meant to say restart the loop. Here is the code I need it for i need it to stop because i only need one solution for each. http://pastebin.com/vA7HeUMi. It is giving me multiple solutions for each. By the way this is Pset2 problem 3
Looks like your pastebin got deleted. Try using dpaste.com as it keeps stuff longer, and doesn't have the annoying ads.
you can try making it recalling the function with a base case and return after that example void main() { for(int i = 0; ;i ++) { printf("waha"); if(i == 10) { main(); return; } } }

Not the answer you are looking for?

Search for more explanations.

Ask your own question

Other answers:

ok i used dpaste this time. http://dpaste.com/hold/525841/ . I actually deleted the last post on purpose though because it had an infinite loop that i didn't notice. Now I just need it to only give me one answer for each instead of every possible solution. After that I will put a counter in to Keep track of how many in a row it gets.
'continue' should help
I finished my code already what i did is made two separate functions and called one function within another that way I could use return. Have we learned the continue function in this course yet and what does it do?
I'm not really sure about the course, but the continue sends the flow of control to the first line of the loop from anywhere within the loop.
o ok what if your using loops within loops which will it return to?
to the inner one
o then that wouldn't have worked but thanks. continue may come in handy later tho.
In your case I guess you could use a flag mechanism with a break or something like that, as per your requirement.

Not the answer you are looking for?

Search for more explanations.

Ask your own question