Hey! how is everybody!
I need help on my little home project.
how do i write a for with no limit of iteration? i need it to stop when a value into the for is reached not when i<=n.

Recommended Answers

All 2 Replies

Use a while loop.

It's so simple - classic forever loop;):

for (;;)
{
     ....
     if (all_done_condition_reached)
        break;
     ...
}

Apropos, the second clause of for statement is a simple (and arbitrary) expression potentially coersed to bool - not only i < n...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.