javascript if shorthand
condition ? doThisIfTrue : doThisIfFalse
1 > 2 ? console.log(true) : console.log(false)
// returns false
javascript if shorthand
condition ? doThisIfTrue : doThisIfFalse
1 > 2 ? console.log(true) : console.log(false)
// returns false
one line conditional statement in c
str = arraeck(a, n) ? "YES" : "NO";
printf(arraeck(a, n) ? "YES" : "NO");
The conditional (ternary) operator with three condition
String year = credits < 30 ? "freshman" : credits <= 59 ? "sophomore" : credits <= 89 ? "junior" : "senior";
conditional (ternary) operator function parameter
//Instead of:
var welcomeMessage = 'Hello ' + (username ? username : 'guest');
//Can use:
var welcomeMessage = 'Hello ' + (username || 'guest');
conditional (ternary) operator function parameter
serveDrink(userIsYoungerThan4 ? 'Milk' : userIsYoungerThan21 ? 'Grape Juice' : 'Wine');
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us