← Reference

Defend the system: cheat sheet

Secret messages · Find each block in the MakeCode toolbox (the category is at the end of each line).

list

Many values in order under one name. Places start at 0. Advanced › Arrays.

let answers = ["Yes", "No"]
The block

length of list

How many items are in the list. The last place is the length − 1. Arrays.

answers.length
The block

get value at

The item at a place in the list, counted from 0. Arrays.

answers[0]
The block

shared code

Send a place number; both micro:bits must hold the same list in the same order.

let words = ["Hi", "Yes", "No"]
radio.onReceivedNumber(function (receivedNumber) {
    basic.showString(words[receivedNumber])
})
The block