Raised This Month: $ Target: $400
 0% 

while() cpu load 100%


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 05-15-2009 , 08:27   Re: while() cpu load 100%
Reply With Quote #1

Yes, don't assume =) because this:
PHP Code:
while( ( iButton find_ent_by_classiButton"func_button" ) != ) ) 
it will be ALWAYS true, because what it checks is if iButton = find_ent_by_class() is not 0, and it does not matter what find_ent_by_class() returns because it checks if the assignment worked, and always does, therefore, infinite loop
the above mistake in less code:
PHP Code:
while(var = != 0
the "var = 0" can be anything that returns true, if you want the result of it, you just:
PHP Code:
while((var = 0) != 0
and the loop will stop, because var is 0 and results false for the loop
__________________
Hunter-Digital is offline
Reply



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 01:28.


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