Refactor <code>if (x > 0) return true; else return false;</code>:
- Acheck_circle
return x > 0;
- B
if (x) return true;
- C
Cannot refactor
- D
return x;
Explanation
Just return the boolean expression.
AP Computer Science A· difficulty 4/5
Refactor <code>if (x > 0) return true; else return false;</code>:
return x > 0;
if (x) return true;
Cannot refactor
return x;
Explanation
Just return the boolean expression.
Want 10 more like this — adaptive to your weak spots?