Skip to content

Recipe for using < instead of <= in for loops conditions #607

@greg-at-moderne

Description

@greg-at-moderne

What problem are you trying to solve?

More readable code with fewer surprises in for loop indexing.

What precondition(s) should be checked before applying this recipe?

Java, for with integer indexes.

Describe the situation before applying the recipe

for (int i = 0; i <= n - 1; i++) {}

Describe the situation after applying the recipe

for (int i = 0; i < n; i++) {}

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