Raised This Month: $ Target: $400
 0% 

true - false


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 06-16-2012 , 14:41   Re: true - false
Reply With Quote #7

Bools and integers are the same. While bools are for better readability, integers can have more options than two, so the usage is situational. If you are sure you will only have the variable to describe a state ( true, false ), you can use bools. If you are however able to put more than two states in one variable, use integers. What I mean is:
PHP Code:
new boolg_LiveRound
new boolg_KnifeRound
new boolg_WarmupRound 
would be worse than
PHP Code:
// let's say 1 is live, 2 is warmup and 3 is knife
new g_Round 
since you can save some memory. If you use enumerations, your code will look even better:

PHP Code:

enum Rounds
{
   
Knife,
   
Warmup,
   
Live
}

new 
Roundsg_Round 

Last edited by Backstabnoob; 06-16-2012 at 14:42.
Backstabnoob 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 06:07.


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