C#
'Else' on conditional return

by oldmud0

bool even(int a) {
    if (a % 2 == 0)
        return true;
    return false;

bool even(int a) {
    if (a % 2 == 0)
        return true;
    else
        return false;

http://eslint.org/docs/rules/no-else-return

Lipis

Neither of the above?

bool even(int a) {

return (a % 2 == 0);

In general I find returns that are not the last line of a function are a source of errors.

Tim Panton

Sign in to comment!