Skip to content

suggestion: clea(n|r)er for loop syntax instead of classic C style one #5944

@jalelegenda

Description

@jalelegenda

I feel a for loop with the following syntax:

    for i in [1..30] 2 {
        println(i)
    }
  • looks cleaner

  • is more readable

  • involves less typing

than the archaic C-style for loop.

few more examples:

    // counter decrement
    for i in [44..22] -2 {
        println(i)
    }

    // step omitted
    for i in [1..100] {
        println(i)
    }

    // side-by-side
    for i in [1..30] 2 {
        println(i)
    }

    for i := 1; i < 30; i += 2 {
        println(i)
    }
    // it took me 24 minutes just to type the above loop

Metadata

Metadata

Assignees

No one assigned

    Labels

    Feature/Enhancement RequestThis issue is made to request a feature or an enhancement to an existing one.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions