Some MakeCode loop blocks such as `on start` and 'forever` contain a built-in 20ms pause. This pause ensures that other parts of your program have a chance to run.

If this slows your program down too much, for example, if you are logging data readings really fast, you can use a while loop as an alternative:

Further Information

The MakeCode editor uses an event scheduler to run your code. The background 20ms pause in the blocks allows the control of the program to be passed back to the scheduler to register other events, for example, a button press.

There's a great explanation of the event scheduler on the MakeCode reference documentation and there is more discussion about the implementation in this historic GitHub issue.