Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReferenceError: dummy is not defined #516

Open
squatica opened this issue Dec 29, 2024 · 0 comments
Open

ReferenceError: dummy is not defined #516

squatica opened this issue Dec 29, 2024 · 0 comments

Comments

@squatica
Copy link

squatica commented Dec 29, 2024

Not sure if this is happening in every level, I experienced it in level 13 RobotMaze:

Whenever I use a while loop, I get an ReferenceError: dummy is not defined

Minimal failing example:

var i = 5;
while (i--) {}

I tracked it down to https://github.com/AlexNisnevich/untrusted/blob/master/scripts/validate.js#L39 I believe it needs a var.

Global variables are apparently not allowed, this code fails with ReferenceError: i is not defined:

i = 5;

When I put a var dummy; somewhere in my code it complains about one more variable - startTime, but then with var dummy, startTime; it works fine.

Passing:

var dummy, startTime;
var i = 5;
while (i--) {}

Confirmed same behavior also on the BFS solution from Yuval (well that one needs one more var in front of new_moves).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant