AP Computer Science Principles

Blocks and values

24 words to know. Each one with what it means, some with an example of how it's used.

Abstract Data Type

A data type defined by a constructor and one or more selectors.

Block

One instruction or expression in Snap!, shaped like a puzzle piece, an oval, or a hexagon; programs are built by snapping blocks together.

Boolean

A value that is either true or false.

Command

A puzzle-piece-shaped block that tells the computer to do something rather than reporting a value.

Condition

A true/false test that an if block or a loop decides on.

Constructor

A block that builds one instance of a data structure from its named pieces.

Control block

A block that decides which other blocks run, or how many times such as if, repeat, forever, repeat until.

Event

Something that happens, such as a click or a key press, that a hat block can detect and respond to.

Execute

To carry out instructions; what the computer does to a block or script when it runs.

Hat

A rounded-top block that runs an attached script when an event occurs.

If block

A control block that runs the blocks inside it only when its condition is true.

Input

A value given to a block that it can use in its code.

List

An ordered sequence of items.

Loop

A block that runs the blocks inside it over and over: forever, repeat, for, repeat until.

Number

A value you can do arithmetic with, like 42 or 3.5.

Predicate

A hexagon-shaped reporter that asks a true/false question and reports a Boolean.

The < block is a predicate because it reports true or false.

Repeat until block

A loop that runs the blocks inside it until the condition in its hexagonal slot becomes true.

Report

To hand a value back from a block to whatever asked for it.

Reporter

An oval-shaped block that computes a value and reports it.

Run

What the user does to make the computer carry out the instructions in a block or script.

Script

One or more connected blocks.

Selector

A block that picks one piece out of a data structure created by a constructor.

Value

A piece of data: a number, text, a Boolean, a list: anything a block can report or that can be passed to a block as an input.

Variable

A name for a value that can be set or accessed.