View Single Post
DarkDeviL
SourceMod Moderator
Join Date: Apr 2012
Old 07-15-2019 , 02:29   Re: Writing good code, solving problems.
Reply With Quote #6

Quote:
Originally Posted by I am inevitable View Post
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 == "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).
__________________
Mostly known as "DarkDeviL".

Dropbox FastDL: Public folder will no longer work after March 15, 2017!
For more info, see the [SRCDS Thread], or the [HLDS Thread].
DarkDeviL is offline