Skip to content

Recipe to prefer increment (++) operator over explicit assignment #664

@greg-at-moderne

Description

@greg-at-moderne

What problem are you trying to solve?

Code readability. i++ is a well-known and understood idiom.

Describe the situation before applying the recipe

i = i + 1;

Describe the situation after applying the recipe

i++;

Any additional context

  • Same can be done for decrements (--).
  • Same can probably be done for increments with specific value, i.e. i = i + 136; -> i += 136;

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions