Microsoft MakeCode

Multiple on start blocks

I noticed the editor allows multiple on start blocks to be created. If you do this the editor appears to flash an exclamation mark warning triangle on first statement briefly and the ones that won’t execute get marked with a diamond background pattern. Precedence might be determined by vertical placement? If you hover over the patterned blocks this text appears:

This block is disabled and will not run. Attach this block to an event to enable it.

Is that the best message for the typical MakeCode programmer?

The simulator allows the program to be executed with this erroneous condition.

Has there been any discussion on allowing multiple on start blocks? Scratch does allows multiple blocks for the equivalent event.

The same thing happens when, say, you have two event handlers for pressing the A button in MakeCode Arcade. One of them gets disabled, because you can only have one function that handles that event.

If you switch back-and-forth between the Blocks view and the JavaScript view, you can see what happens to the on start code: It’s the top-level code for your program, not an event handler. You can’t have multiple on start blocks because the code doesn’t get placed inside of a function or anything like that.

You can have multiple on update blocks, though, because those get handled differently.