29.06.2013, 00:43
Quote:
|
Better question, why? You clearly have code that works, shortening it will not make it "more efficient" (whatever people think that means) and will just make the code harder to read.
|
pawn Code:
toggle = !toggle;
pawn Code:
toggle = toggle ? false : true;
Code:
[02:45:40] Starting benchmark test with 3 tests each method with 1000000 loops... [02:45:40] Toggler - "ternary operator" the 1. [02:45:40] 1. result of ternary operator toggling: 99 ms [02:45:40] Toggler - "ternary operator" the 2. [02:45:41] 2. result of ternary operator toggling: 99 ms [02:45:41] Toggler - "ternary operator" the 3. [02:45:41] 3. result of ternary operator toggling: 99 ms [02:45:41] Toggler - "equals not" the 1. [02:45:41] 1. result of equals not toggling: 84 ms [02:45:41] Toggler - "equals not" the 2. [02:45:41] 2. result of equals not toggling: 84 ms [02:45:41] Toggler - "equals not" the 3. [02:45:41] 3. result of equals not toggling: 84 ms [02:45:41] Benchmark test finished!

