Permalink
Fetching contributors…
Cannot retrieve contributors at this time
76 lines (57 sloc) 831 Bytes

Invert if

Property Value
Id RR0189
Title Invert if
Syntax if statement
Span if keyword
Enabled by Default

Usage

Before

if (condition1)
{
    if (condition2)
    {
        Foo();
    }
}

After

if (!condition1)
{
    return;
}

if (!condition2)
{
    return;
}

Foo();

Before

if (!condition1)
{
    return;
}

if (!condition2)
{
    return;
}

Foo();

After

if (condition1)
{
    if (condition2)
    {
        Foo();
    }
}

See Also

(Generated with DotMarkdown)