Quote:
Originally Posted by I am inevitable
Now, this code is perfectly fine, but. We can shorten it... a lot:
|
It would have been even 'shorter', if you didn't create a new "iTeam" variable, and simply used:
like in the first example.
The
ternary operator:
PHP Code:
iTeam == 3 ? "Counter-" : ""
isn't always as useful, such as for example if the code you want to act based on the result of the condition is spanning more than one line, in these situations the classic if-then-else conditions may be more appropriate (and make the code more readable in the end).
__________________