Skip to content

[QUESTION] cpp2 for loops #1063

Closed
Closed
@dutkalex

Description

@dutkalex

Hi! My question is rather simple, but I could not find the answer in the documentation nor in other issues. What is the cpp2 equivalent for:

for ( int i = a; i < b; ++i ){
  // loop body
}

All the examples in the documentation seem to be range-based for loops, and the closest I could find (which is obviously not the right answer) is:

for std::views::iota{ a, b } do ( i ){
  // loop body
}

Thanks for the amazing work!
Best regards,
Alex

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions