1 min readMar 15, 2018
if statement replacement
I don’t believe that the ternary operator
is a total replacement for the if
statement.
Simple example
if(false) {
doSomething();
}... code continue// if is ignored
A ternary operator is some sort of if else
// Is this true ? do this! : Otherwise do this; SomeTrueVar ? willDoThis : ElseActionOrValue;
The difference here lies in the fact you must gives an else
condition to the ternary.