Re: Equivalence


[ Follow Ups ] [ Post Followup ] [ CS2604 Discussion WWWBoard ] [ FAQ ]

Posted by DarkTerritory on August 04, 1999 at 17:08:52:

In Reply to: Re: Equivalence posted by hussein on August 04, 1999 at 15:49:32:

: :


: : for (int i=0; (i<10) && (test); i++) {
: : do_something();
: : }
: :

: :

: : for (int i=0; i<10; i++) {
: : if (test) do_something();
: : else break;
: : }
: :

: in the first case, as soon as test fails, the loop terminates.

: in the second case, the loop continues even after test fails for the first time.

Doesn't the "else break" cause the loop to die in the event test fails? If I am mistaken, what does it do?

-DT



Follow Ups:



Post a Followup

Name:
E-Mail:

Subject:

Comments:

Optional Link URL:
Link Title:
Optional Image URL:


[ Follow Ups ] [ Post Followup ] [ CS2604 Discussion WWWBoard ] [ FAQ ]