micro:bit - Subroutines

How to make a function

Under the 'Advanced' options, choose 'Functions'.

Click the 'Make a Function...' button.

Give the function a meaningful name that says what the subroutine will do.

Add the code you want the subroutine to perform.

There is now a new block in the Functions menu that will call our subroutine!

You can use that new block in your actual program.

Making Subroutines (Functions)