Pawn Tutorial on wiki
Question for you guys real quick to make sure i understand this seems simple enough
PHP Code:
</span>1. Check if the condition is true. If so, continue. If not, stop. 2. Run the code. 3. Run the "increment" parameter. 4. Go to step 1. Now if i do it like. PHP Code:
1. Check if the condition is true. If so, continue. If not, stop. 2. Run the "increment" parameter. 3. Run the code. 4. Go to step 1. Would that be the difference between the ++i and i++ |
Re: Pawn Tutorial on wiki
There is no differences, the increment paramater is always done after
++i or i++ makes no difference in a for loop. In the following code, difference would be that in function 1 checks starts with i == 2 and in fonction2 checks starts with 1. So, ++i, i is incremented first and its result is then returned, with i++, i value is returned before it is incremented. PHP Code:
Would have an importance in a for loop if you would do something like : for(new i=val; ++i < SOME_VALUE; some other check) |
Re: Pawn Tutorial on wiki
Thanks for the clarifications on to page two lol.
|
Re: Pawn Tutorial on wiki
Here's another example
PHP Code:
But with this other code PHP Code:
|
Re: Pawn Tutorial on wiki
Prefix operator does his job before the expression evaluation.
Postfix operator evaluates to the original value, and then increments the variable. EDIT: Postfix = c++, prefix = ++c |
Re: Pawn Tutorial on wiki
Prefix and postfix have no difference in this situation.
PHP Code:
2. if condition false, exit loop without doing anything else (no increment or code executed) 3. execute code 4. increment 5. repeat back to #2 It's that simple. |
Re: Pawn Tutorial on wiki
I know. My explanation wasn't on this specific case, since the last for instruction is executed on it's own.
And the third for parameter doesn't need to be an increment, it's just a statement. |
Re: Pawn Tutorial on wiki
Quote:
I wasn't naming it like that just because it's supposed to be an increment. |
Re: Pawn Tutorial on wiki
I'm not arguing with you, I was just explaining that this:
Quote:
I'm just helping others, not correcting you. We're all building content for newcomers. |
Re: Pawn Tutorial on wiki
Quote:
in a while loop ++i and i++ are pretty important depending on what you are doing. |
| All times are GMT -4. The time now is 08:44. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.