INDEX
Index of Computer Science Terms defined for Grades K-12
Boolean: A variable that can only be true or false.
The Code:
let Fed = false //Fed is the boolean
input.onButtonPressed(Button.A, function () {
Fed = true //A button press-> Fed is true
})
input.onButtonPressed(Button.B, function () {
Fed = false //B button press-> Fed is false
})
basic.forever(function () {
if (Fed == true) {
basic.showIcon(IconNames.Happy)
//the happy face will only show if Fed==true
} else {
basic.showIcon(IconNames.Sad)
//otherwise it will be a sad face
}
})

Code available here
Conditional: A block of code that only occurs if a specific statement chosen by the programmer is true.
The Code:
input.onButtonPressed(Button.A, function () {
myGuess += 1
})
input.onButtonPressed(Button.B, function () {
myGuess += -1
})
// the conditional is the "if...else" code below
input.onButtonPressed(Button.AB, function () {
if (myGuess == secretNumber) {
basic.showString("Congrats!")
// if guess equals secretNumber you win!
} else {
basic.showString("Try Again!")
// if guess doesn't equal secret try again
}
})
let myGuess = 0
let secretNumber = 0
secretNumber = 5
myGuess = 0

Code available here
Variable: A container to store one piece of information. This could be a number, a String, a boolean etc.
The Code:
let favColour = "" // create the container, give it a name and store information in it
input.onButtonPressed(Button.A, function () {
favColour = "blue" // press A to change the information in the container to "blue"
})
input.onButtonPressed(Button.B, function () {
favColour = "red" // press B to change the information in the container to "red"
})
input.onButtonPressed(Button.AB, function () {
basic.showString(favColour)
}) // display whatever information stored in the container

Code available here
Name-Value-Pair: A special variable that assigns a name of type string to a numerical value. These values are treated as a pair and are sent together and can be evaluated together.
The Code:
input.onGesture(Gesture.Shake, function () {
radio.sendValue("Temperature", input.temperature())
})
//name-value-pair used in the code below
radio.onReceivedValue(function (name, value) {
basic.showString(name)
basic.showNumber(value)
})

Code available here