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.
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.
No comments:
Post a Comment