1. No Profile Picture
Registered User
Devshed Newbie (0 - 499 posts)

Join Date
Jan 2013
Posts
2
Rep Power
0

#### For loop

what does this do..?

Q1? for(;;);
Q2? for(p(a);p(b);p(c););
2. No Profile Picture
Registered User
Devshed Newbie (0 - 499 posts)

Join Date
Feb 2004
Posts
20
Rep Power
0
Originally Posted by Viky
what does this do..?

Q1? for(;;);
Q2? for(p(a);p(b);p(c););
Q1: endless loop.

Q2: How about you try describing what you think it does and we'll correct you. That's ultimately a better way to learn.

• clifford disagrees : Well done Walt - you did somone's homework for them! That's not normally how it works around here - the last thing we need is graduates knowing nothing except how to cheat.
3. clifford disagrees: Well done Walt - you did somone's homework for them! That's not normally how it works around here -
the last thing we need is graduates knowing nothing except how to cheat.
My apologies Walt; somewhat unfair - you only answered the first question. :o I did not however down-rep you in my response if that is any consolation.
Last edited by clifford; January 13th, 2013 at 04:40 AM.
4. A for statement comprises four parts:
1. 1 Initial expression,
2. 2 loop condition expression,
3. 3 loop body
4. 4 iteration expression

And operates thus:

do 1 then while 2 do 3 then 4

Any of 1,2,3 or 4 may be empty (or null) statements. A null statement is just a semi-colon on its own.

An expression is implicitly "true" is it is non-zero.

That is all you need to know to work out the answer to both.