Raised This Month: $32 Target: $400
 8% 

Solved How is this named?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
AnimalMonster
Senior Member
Join Date: May 2020
Old 10-05-2021 , 13:05   How is this named?
Reply With Quote #1

Hey, i've always wondered, how are these named?
PHP Code:
//Example 1
new = (2)
//Example 2
new = (y-== 2

Last edited by AnimalMonster; 10-11-2021 at 10:58.
AnimalMonster is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 10-05-2021 , 13:15   Re: How is this named?
Reply With Quote #2

ternary operator or "how to kill readability with one easy trick".
__________________
HamletEagle is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 10-05-2021 , 17:03   Re: How is this named?
Reply With Quote #3

Conditional operators or as HamletEagle said ternary operators.
__________________
edon1337 is offline
lexzor
Veteran Member
Join Date: Nov 2020
Old 10-05-2021 , 17:06   Re: How is this named?
Reply With Quote #4

can you use like this?

PHP Code:
== ? (== yes no) : 
lexzor is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 10-05-2021 , 18:46   Re: How is this named?
Reply With Quote #5

Useful, but don't obsess over them just to make your code have less lines.

For simple things like this they are fine:
PHP Code:
formatexstr len "bugsy likes %s" Day == Friday "beer" "water" ); 
Don't do things like this:
PHP Code:
== set_user_gravityid ) : == user_killid ) : set_god_modeid ) : give_moneyid 500 ); 
@lexzor - Yes, you can do nested statements.
__________________

Last edited by Bugsy; 10-05-2021 at 18:46.
Bugsy is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 10-05-2021 , 20:58   Re: How is this named?
Reply With Quote #6

I learned that they should really only be used for simple assignment, never when you're conditionally executing functions.
__________________
fysiks is offline
AnimalMonster
Senior Member
Join Date: May 2020
Old 10-08-2021 , 22:29   Re: How is this named?
Reply With Quote #7

Thanks for the information!
AnimalMonster is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 11:05.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode