05.10.2007, 18:20
Nice thing ******, i'm just wondering if it's really more efficient than normal loops (if there is not much thing to do in the loop).
To add something useful in this post, probably a lot of people ignore this:
Instead of doing something like this (beginner method):
Or..like that (intermediate method):
You can simply do (leet method):
Run Test() a few time, this will print alternatively "B is now false", "B is now true", "B is now false"...
They all do the same thing, the last one is just much easier to write, i've found this there is a few days.
This obviously works only for booleans and this can be useful for toggleable commands/options, things like that.
PS: Why Useful topics are all un-stickied ?
To add something useful in this post, probably a lot of people ignore this:
Instead of doing something like this (beginner method):
pawn Код:
new bool:B = true;
Test()
{
if (B)
B = false;
else
B = true;
printf( "B is now %s", (B ? ("true") : ("false")) );
}
pawn Код:
new bool:B = true;
Test()
{
B = B ? false : true;
printf( "B is now %s", (B ? ("true") : ("false")) );
}
pawn Код:
new bool:B = true;
Test()
{
B = !B;
printf( "B is now %s", (B ? ("true") : ("false")) );
}
They all do the same thing, the last one is just much easier to write, i've found this there is a few days.
This obviously works only for booleans and this can be useful for toggleable commands/options, things like that.
PS: Why Useful topics are all un-stickied ?