C# + ternary operator code example
Example 1: ternary operator
(condition) ? (if true, do this) : (otherwise, do this)
Example 2: 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)