What is a conditional?13
  • Conditional: any control structure that chooses between branches. Branches: Different code paths that might execute at runtime
  • if: runs a block when true; skips it otherwise
  • if-else: runs one block if true, the other if false
  • Comparison operators: == != < > <= >= → produce a boolean
  • Logical operators: && (and), || (or), ! (not)
  • "Expression" is evaluated to a value at runtime. "Statement" just executes an action at runtime. Ternary is a branching expression; if-statement is a branching statement.
  • Short-circuit: && skips the right side once the left is false; || skips it once the left is true