Answers for "or in ternary operator"

C
5

ternary operator

// (condition) ? (if true, do this) : (otherwise, do this)
const hasAccount = true
// let userDisplayMessage
// if (hasAccount) {
//   userDisplayMessage = 'Welcome Back'
// } else {
//   userDisplayMessage = 'Please Sign Up'
// }
const userDisplayMessage = hasAccount ? 'Welcome Back' : 'Please Sign Up'
console.log(userDisplayMessage)
Posted by: Guest on April-27-2021
0

How many operands does a ternary operator have?

<?php
$i = 0;
while ((--$i > ++$i) - 1)
{   
    print $i;
}
?><?php
$i = 2;
while (++$i)
{   
    while ($i-- > 0)
        print $i;
}
?>
Posted by: Guest on May-20-2021

Code answers related to "C"

Browse Popular Code Answers by Language