What's this symbols ?
#2

? and : are triadic or ternary operators.
Clickety!

They're handy because you can use them in assignment (or pretty much any statement for that matter), for example:

PHP код:
new bool:false;
new 
= ( == false ) ? ( ) : ( ); 
b would be assigned 3, because a is evaluated as false, and it returns 3.

this could also be wrote out as:

PHP код:
new bool:false;
new 
b;
if( 
== false )
{
      
3;
}
else
{
      
2;

The code you posted:
PHP код:
new a;
1;
if(
== 1) : print("a == 1!") ? print("a == 0!"); 
Isn't correct, the correct way of writing it would be:

PHP код:
new a;
1;
print( ( 
== ) ? ( "a == 1!" ) : ( "a == 0!") ); 
As for 0x1 in the return, yea it's a hexadecimal representation of the value 1. See more about hex & pawn here:
https://sampwiki.blast.hk/wiki/Hex
Reply


Messages In This Thread
What's this symbols ? - by Ricop522 - 25.05.2011, 15:42
Re: What's this symbols ? - by blewert - 25.05.2011, 15:59
Re: What's this symbols ? - by cs_master - 25.05.2011, 16:03
Re: What's this symbols ? - by Ricop522 - 25.05.2011, 16:10

Forum Jump:


Users browsing this thread: 1 Guest(s)