1if (true)
2 printf("This is the shorthand");
3
4// OR
5
6(true) ? (/*run if true*/) : (/*run if false*/);
1condition ? doThisIfTrue : doThisIfFalse
2
31 > 2 ? console.log(true) : console.log(false)
4// returns false
1String year = credits < 30 ? "freshman" : credits <= 59 ? "sophomore" : credits <= 89 ? "junior" : "senior";
1var age = 26;
2var beverage = (age >= 21) ? "Beer" : "Juice";
3console.log(beverage); // "Beer"
4