pxt-core
Version:
Microsoft MakeCode provides Blocks / JavaScript / Python tools and editors
32 lines (21 loc) • 804 B
Markdown
event that runs when the program starts.
```blocks
let thousand = 1000
```
The ``on start`` is a special event that runs when the program starts, before any other event.
Use this event to initialize your program.
Where is ``on start``...?
```typescript
function onStart(){} // I don't exist
```
``on start`` **only** exists in the block editor. In JavaScript, all code executes sequentially starting
at the first line.
When we transform the blocks into JavaScript, we always place all the event registrations (buttons, shake, ...)
before launching the ``on start`` code.
If a block from ``on start`` pauses, other registered events will have the opportunity to run as well.
## #eventorder
## #examples
An