in reply to Re^4: Closures and scope of lexicals
in thread Closures and scope of lexicals

I didn't translate the first snippet. The question is about the second snippet. The OP asked if its behaviour is a quirk. I showed that it's not by showing that the behaviour is consistent across many languages.

Replies are listed 'Best First'.
Re^6: Closures and scope of lexicals
by LanX (Saint) on Oct 31, 2024 at 14:37 UTC

      Then you're wrong. The provided code is equivalent to the OP's, and the result is consistent.

        Saying Python's behavior is consistent to Perl's is at best an over simplification and can't be left uncommented.

        JS on the other side is very consistent to Perl, especially when using let

        Cheers Rolf
        (addicted to the Perl Programming Language :)
        see Wikisyntax for the Monastery