© Pradeeka Seneviratne  2019
Pradeeka SeneviratneBBC micro:bit Recipeshttps://doi.org/10.1007/978-1-4842-4913-0_9

9. Using Variables

Pradeeka Seneviratne1 
(1)
Udumulla, Mulleriyawa, Sri Lanka
 

This chapter presents how to create variables to hold various types of data such as numbers, strings, arrays, and Boolean values. It also presents how to take data out from the variables for further processing, and how to change data stored in the variables during the execution of the code.

9-1. Creating Integer Variables

Problem

You want to create a variable and store the value 100 in it, then display the content on the micro:bit display.

Solution

  • In the Toolbox, click on the Variables category and then click the Make a Variable... button (Figure 9-1 ).
    Figure ...

Get BBC micro:bit Recipes: Learn Programming with Microsoft MakeCode Blocks now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.