Skip to content

Recipe to prefer numeric comparison a == b over a - b == 0 #665

@greg-at-moderne

Description

@greg-at-moderne

What problem are you trying to solve?

Code readability.

Describe the situation before applying the recipe

return a - b == 0;

Describe the situation after applying the recipe

return a == b;

Any additional context

a - b might be in parentheses.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions