Skip to content

Latest commit

 

History

History
76 lines (57 loc) · 831 Bytes

RR0189.md

File metadata and controls

76 lines (57 loc) · 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)