Other Languages

Php Operators, Logical

Logical operators works only with Boolean
PHP will first convert any other value to a Boolean 

if (isset($a) && $b) { ... }
$a ?: $b // ternary shorthand
Ternary

Python Goodies, Conditional Expression

Conditional expression, concise statement
Very useful when using recursion

def factorial(n):
  return 1 if n == 0 else (n * factorial(n-1))
Ternary



Javascript

Javascript Fundamentals, Conditional

The if statement converts the result to a boolean
The ternary operator has three operands
OR return the first truly one

if (age > 18) {}
b = a > 18 ? Yes : No
(1 || 0) === 1 // true
Ternary