Ternary operator ( ?: )Short if/else.Syntax$result = condition ? a : b;Descriptiona if condition is true, b if false. ?? is also used for 'default if null'.ExampleLoading editor…▶ Try it yourselfExpected outputadultWhen to use?Short conditional value.Related commandsif / elseif / else← if / elseif / elsefor →