View Single Post
danielkza
AMX Mod X Plugin Approver
Join Date: May 2007
Location: São Paulo - Brasil
Old 10-26-2008 , 10:10   Re: [TUT/INFO] ? and : function
Reply With Quote #15

Quote:
Originally Posted by Lee View Post
Could you give an example or two please?
Code:
new a=1, b=2, c=3,d
d=a ? b : a + b
Could you tell what would be the result of this expression? It could be interpreted in many ways.

With the correct brackets:
Code:
d = a ? b : (a+b)
But you have to be careful. It may not be what you want. You may want this:
Code:
d = (a ? b : a) + b
So if you have any doubts, just make sure the results of the expression are within brackets so you don't run in any problems like those, which can be hard to find out.
__________________

Community / No support through PM
danielkza is offline