-moz-user-select:none; -webkit-user-select:none; -khtml-user-select:none; -ms-user-select:none; user-select:none;

Saturday 21 March 2015

Conditional operator

In this blog,I will explain the concept of conditional operator.
Many students got confused with it.So,don't get confused and try to understand this simple concept.

Conditional operator or ternary operator works same as "if-else" statement.The only difference is the syntax.e.g., the syntax for "if-else" is

if(condition)
statement;
else
statement;

while the syntax of conditional operator is

(condition)?statement(if true):statement(if false);

So,now to explain conditional operator more clearly,I will use a simple example.Hope that you will find it beneficial.


Source code


khgamujtaba,C++

Output

khgamujtaba,C++



No comments:

Post a Comment