[Tutorial] Use bool variables: It's easy.
#5

@sammp : The only differences between this :

pawn Code:
new variable = 0;
if(!variable) // or if(variable == 0)
      variable = 1;
if(variable) // or if(variable == 1)
      return 1;
And this

pawn Code:
new bool:variable = false;
if(!variable)
      variable = true;
if(variable)
      return 1;
Are :

• The use of booleans just takes a byte (or 4, i don't exactly remember) in memory (instead of a 32 bytes integer, which, as its name says, takes 32 bytes).
• Using booleans and the direct way of checking a value ( "if(variable)" or "if(!variable)"), you code faster and you are sure to check only a value.

And btw, if using booleans is useless, then using programming convention is useless. (all the programming convention does is to make a code clearer, what a pointless feature don't you think ?)
This way, using the #define directive becomes also useless because all it does is to define a macro that we can code ourself each time. (again, so useless)

Just use your common sense : if the booleans were created, it's because of a very good reason.
Reply


Messages In This Thread
Use bool variables: It's easy. - by Baltimore - 11.07.2014, 16:31
Re : Use bool variables: It's easy. - by S4t3K - 11.07.2014, 16:41
Re: Use bool variables: It's easy. - by Baltimore - 11.07.2014, 16:46
Re: Use bool variables: It's easy. - by sammp - 11.07.2014, 20:32
Re : Use bool variables: It's easy. - by S4t3K - 12.07.2014, 19:17
Re: Use bool variables: It's easy. - by Vince - 12.07.2014, 19:30
Re : Use bool variables: It's easy. - by S4t3K - 12.07.2014, 19:52
Re: Use bool variables: It's easy. - by Vince - 12.07.2014, 20:07
Re: Use bool variables: It's easy. - by PT - 13.07.2014, 00:26
Re: Use bool variables: It's easy. - by Juvanii - 13.07.2014, 06:06

Forum Jump:


Users browsing this thread: 4 Guest(s)