English

Compare an if and a ? : operator.

Advertisements

Question

Compare an if and a ? : operator.

Distinguish Between
Advertisements

Solution

The if statement evaluates a condition, if the condition is true then a true-block is executed, otherwise false-block will be executed! Block may consist of one or more statements. The conditional operator (or Ternary operator). is an alternative for the ‘if-else statement’. Here if the condition is true one statement otherwise another statement will be executed.

shaalaa.com
Statements
  Is there an error in this question or solution?
Chapter 10: Flow of Control - Evaluation - Section - B [Page 178]
Advertisements
Share
Notifications



      Forgot password?
Use app×