inline if code example
Example 1: js inline if
var a = 2;
var b = 3;
var c = ((a < b) ? 'minor' : 'major');
Example 2: ternary operator
(condition) ? (if true, do this) : (otherwise, do this)
Example 3: c# ternary
string stateOfMatter;
int temperature = 23;
stateOfMatter = temperature < 0 ? "Solid": "Liquid";
stateOfMatter = temperature < 0 ? "Solid" : (temperature > 100 ? "Gas" : "Liquid");
Example 4: c# inline if
(condition ? [true value] : [false value])
int x = a ? b : c;
Example 5: c# ternary condition
condition ? consequent : alternative
Example 6: inline if in html component
Condition ? Block_For_True : Block_For_False