Raised This Month: $ Target: $400
 0% 

Loop wont run more than 4 times


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 04-06-2011 , 16:39   Re: Loop wont run more than 4 times
Reply With Quote #4

continue stops executing the loop for that 1 iteration and goes to the next one.
Also, continue can be used in all types of loops.

Example:

Code:
for(new i = 0; i < 4; i++) {     if(i == 1) continue;         server_print("%d", i); }

This would be the process:

Code:
create and initialize i to 0
0 < 4 so do loop
0 is not 1, so go past this
print 0
0++ = 1
1 < 4 so do loop
1 is 1, so do not go past this
1++ = 2
2 < 4 so do loop
2 is not 1, so go past this
print 2
2++ = 3
3 < 4 so do loop
3 is not 1, so go past this
print 3
3++ = 4
4 is not < 4 so exit loop
Print output:

Code:
0
2
3
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 19:57.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode