Equivalent Boolean Expressions (De Morgan's Laws)

AP Computer Science A· difficulty 4/5

Simplify <code>if (a == true) return true; else return false;</code>

  • A

    if (a) return true;

  • B

    return a;

    check_circle
  • C

    return a == true;

  • D

    return !a;

Explanation

Just return the boolean directly.

Want 10 more like this — adaptive to your weak spots?

Related questions