Running the code

Where and when do we need to run the code?

Let us break this to you - whether you program in TypeScript by using our Monaco editor, or you compose components of Blockly and Rete - you are in fact programming. Programming means that you are creating a code that needs to be executed and interpreted by the computer. It also has to be correct. If it is not correct, you will be shown an error during it's execution or the result that you will see will be incorrect or non-existant.

In order to see the results of your programming, you will have to click a magic "Run" button, that will execute your program. Both Blockly and Monaco for TypeScript are built in such a way that this step is mandatory. You must click the button every time you want to see an udpate. Rete editor is a bit different. Rete editor reacts to any change that you make on the canvas and runs the script automatically for you. The first time you open the editor though, code of Rete will not be executed. This is done for safety reasons, as you might have a script that takes a long time to execute and you would not want to wait for it to finish every time you open some code for inspection. Running the script should be your choice. So, in Rete, you can also click the Run button, but it only has effect the first time you open the script. After that, you can simply interact with the canvas and updates will propagate.

Where is that Run button?

The run button looks like this and is located in the bottom menu. That menu, depending on the screen size can appear on the bottom of your editor aligned in a horizontal direction or vertically on the left side of the screen.

Image showing the menu button to run you code in the scripts

Button To Run The Code

What happens if the program fails to Run and compute?

This depends on few circumstances. Sometimes the bad code will never finish to compute. You may have asked the computer to do something impossible. There are ways even in visual programming to create infinite loops. If you do that, the program will never finish to compute and you will have to stop it manually. There is a high chance that your browser tab will be hanging during such a computation, thus you may even need to close your browser tab. This is why we recommend to save your work often if you have not subscribed to our platform - if you did, we will be saving your work to our database every 15 seconds.

Check out our section where we talk about errors in the scripts to learn more about the things that may happen when programs fail.

How do I know that the code works?

There are plenty of situations where your code may be correct, but the result that you see is not what you expected. This is why we recommend to always check the result of your code by drawing something on the screen - it can be a 3D object or a text. You can also output some text in your console. If you are using Monaco for TypeScript, Blockly or Rete editors and you tell the program to draw some 3D objects on the screen, you can check the result by clicking the "Swap Canvas" button. This will take you to the 3D environment where you can interact with the result of your code. Here is the "Swap Canvas" button.

Image showing the button to swap the canvas and switch between 3D and coding environments

Button to swap the canvas and switch between 3D and coding environments

What happens if the script runs correctly

We do not give you any success messages if the script executed correctly. You need to check it yourself if everything looks as intended. Some time consuming algorithms will trigger a spinner to be shown instead of a "Run" button. If the spinner appears that generally means that computation is still in progress. Keep in mind, that depending on the difficulty of the program even correct code can take a while to compute. Some of the CAD algorithms are in particular heavy.