Showing results for 
Search instead for 
Did you mean: 
Copilot Lvl 2
Message 1 of 2

Issues trying to eliminate global variables in Blockly

 I am trying to get my Blockly code to run without global variables. How would I change it in blocks to get the resulting Python and JavaScript codes to run without using globals? The code I currently have will generate the desired output, but only one line at a time, and you have to keep hitting enter to get each line of output. How can I fix that as well, and just get all of the output at once?


I am new to coding and this is for a class. I'm really stuck, any help would be much appreciated!!

1 Reply
Commander Lvl 3
Message 2 of 2

Re: Issues trying to eliminate global variables in Blockly

Hi @GreenCheek and welcome to the forum,


I wrote this script for you that should do the trick. It's a lot cleaner than the one generated by Blockly:


As for Blockly, I don't really know how to get it done - and also don't know if it's possible.


But definitely let know if the Gist works for you and if you have any other questions!

- Mark