Comment

Comment by weatherlight

It's not the same.

    > [a, 2, 2, b] = [1, 2, 2, 3]
    [1, 2, 2, 3]
    > a
    1
    > b
    3
    > [foo, 2, bar] = [3,3,3]
    %MatchError{term: [3, 3, 3]}
    > foo
    %CompileError{description: "undefined function foo/0 (there is no such import)", file: "nofile", line: 1}

Ruby does something similar but the variables are bound in the scope of the case block.

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton