Instead if (a) { return 1; } else { return 2 } do if (a) { return 1; } return 2; Else is superfluous.