Skip to content

Variable scope-local to for loop gets carried over loop iteration #10525

Description

@t-nil

Fish v3.7.1, tested with clean home.

https://asciinema.org/a/jZhHcUByvJ80NkbRp75krG8x4

When set -l var'ing in a loop, the variable stays set in the following loop iterations.

Expected

Like in example 2 with the explicit begin; …; end I would expect the variable to go out of scope in every loop iteration (as is the case with any major programming language today AFAIK).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething that's not working as intendedrelease notesSomething that is or should be mentioned in the release notes

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions