Skip to content

Nested for loop syntax & break behavior #5154

Description

@quinnj

I noticed this today

In  [8]: for a = 1:3, b = 4:6
    b == 5 && break
    println("a = $a")
    println("b = $b")
end

a = 1
b = 4
a = 2
b = 4
a = 3
b = 4

(i.e. the break only breaks the inner loop).
I'm not saying this is wrong, but it might be good to add a sentence or two about it in the docs as one might think that the nested loop syntax only creates a single loop to break from.

Metadata

Metadata

Assignees

No one assigned

    Labels

    breakingThis change will break codeneeds decisionA decision on this change is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions