Home World Forum
Stars! AutoHost web forums

Jump to Stars! AutoHost


 
 
Home » Stars! Clones, Extensions, Modding » FreeStars » Javascript Race Wizard
Re: Javascript Race Wizard Wed, 17 June 2009 21:23 Go to previous messageGo to previous message
gible

 
Commander

Messages: 1343
Registered: November 2002
Location: Wellington, New Zealand

sirgwain wrote on Thu, 18 June 2009 04:20

for (h = 0; h < 3; ++h)


the difference between h++ and ++h the is order of the incrementing of h and evaluation of the expression as a whole:
++h increments h before the evaulation and thus affects the evaluation.(preinc)
h++ increments h after the evaluation and thus does not affect the evaluation.(postinc)

The simplest examples are:
h=1;
x=(++h);
//A

h=1;
y=(h++);
//B
at both points (A&B) h has been incremented so h=2 but at A, x=2 and at B, y=1.

The third part of the for loop tuple is a statement to be run after each iteration. As a stand alone statement not included as part of a larger expression, both h++ and ++h have the same effect since the evaluation is never used - such as in a for loop.


[Updated on: Wed, 17 June 2009 21:30]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Does a starbase persist damage?
Next Topic: I miss Stars! How do I get back in?
Goto Forum:
  


Current Time: Mon May 06 07:16:45 EDT 2024