







This is an excellent substitute to the control statement like IF/THEN/ELSE

of BASIC language. It is denoted by the combinational characters ?: and

follows the usage with the following format/syntax :


value variable = (test expression) ? expression1 : expression2;



which indicates that if the test expression is true then the transfer value

for storage into the value variable is expression1 and if the test

expression is false the transfer value becomes the expression2.


for example:
grade = (total > 40) ? ‘P’ : ‘F’;





In the above example grade refers to the value variable, total>40 is the


test expression, ‘P’ is the expression1 and ‘F’ is the expression2. The ?

character follows the true condition and : follows the false condition.


attention@computerscienceexpertise.com

















