You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
All variable scope, as of this version, is local to the enclosing function or to the main program block. Variables are only accessible after declaration, and there is no global scope.
This makes me think that a variable should be visible within the function or main program block wherever it's defined, as long as that's above the point where it's accessed. However, the program
HAI 1.2
BOTH SAEM 1 AN 1
O RLY?
YA RLY
I HAS A variable ITZ "Hello World!"
VISIBLE variable
OIC
VISIBLE variable
KTHXBYE
generates the output
Hello World!
/tmp/hello.lol:8 variable does not exist: variable
I guess the actual scope is more narrow than the enclosing function. This seems like a bug to me, either in the implementation or in the specification.
The text was updated successfully, but these errors were encountered:
sjoqvist
changed the title
Variable scope doesn't work as specified
Variable created inside conditional block isn't visible in main program block
Aug 26, 2019
The specification says
This makes me think that a variable should be visible within the function or main program block wherever it's defined, as long as that's above the point where it's accessed. However, the program
generates the output
I guess the actual scope is more narrow than the enclosing function. This seems like a bug to me, either in the implementation or in the specification.
The text was updated successfully, but these errors were encountered: