[Tutorial] A more close look at Ternary Operators
#2

Ternary Operators: Ternary operators deal with three operands.These operators are known as conditional operator as because the value assigned to a variable depends upon a logical expression.

Syntax:

variable= (test expression) ? Expression 1 : Expression 2;

Example:

pawn Code:
new a=5,b=3,max=0,min=0;

max=(a>b)? a:b;
// Here, the value 5 is stored in max as a>b is true.

min= (b>a)? a:b;
// Here, the value 3 is stored in min as b>a is false.
@BroZeus: You should write a proper definition so that scripters can understand easily, writing "Basically ternary operator are used in place of "if" and "else" statements. They consists of a "?" and a ":" sign." will not do the work. As it is your first tutorial I'll suggest you to research before posting.Nice try though. I suggest all the scripters/coders to use if-else because it can be nested easily and you can profitably make your code execute.
Reply


Messages In This Thread
A more close look at Ternary Operators - by BroZeus - 02.07.2014, 10:11
Re: A more close look at Ternary Operators - by Rittik - 02.07.2014, 10:48
Re: A more close look at Ternary Operators - by BroZeus - 02.07.2014, 10:52
Re: A more close look at Ternary Operators - by Rittik - 02.07.2014, 11:02
Re: A more close look at Ternary Operators - by BroZeus - 02.07.2014, 11:05
Re: A more close look at Ternary Operators - by Rittik - 02.07.2014, 11:08
Re: A more close look at Ternary Operators - by BroZeus - 02.07.2014, 11:12
Re: A more close look at Ternary Operators - by Vince - 02.07.2014, 11:30
Re: A more close look at Ternary Operators - by BroZeus - 02.07.2014, 13:22
Re: A more close look at Ternary Operators - by Pottus - 02.07.2014, 13:58

Forum Jump:


Users browsing this thread: 1 Guest(s)