#>instructions_followed
values control flow functions

Software / Building Blocks

How a Computer Follows Instructions

A program gives a computer instructions. It works with the values you supply and the rules you write, so a small mismatch between your intention and your rule can change the result.

  • Values are the material: a cue name, a duration, or whether a prop is available.
  • Variables give values names so later instructions can use them.
  • Control flow chooses what runs next through conditions and loops.
  • Functions package a task behind a name. A function that checks a cue can be called for every prop and tested with several examples.

Trace a cue decision to see those ideas work together.

#>programs_essentials

Programs Essentials

A guided first language

MDN's JavaScript guide, from values to functions, runnable in any browser.

mdn: JavaScript guide

A complete first course

Harvard's CS50, free, with problem sets that build real habits.

cs50

The analyst's first language

The official Python tutorial, the usual starting point for data work.

python: tutorial

Turn the quiet-room rule into a decision

Bring the rule from Logic: a cue must be available and known to be silent. Here is that decision in JavaScript. You can trace it on paper; the code is also ready to run in a JavaScript console.

function canPlay(cue) {
  return cue.available === true && cue.sound === false;
}

const lantern = { available: true, sound: false };
canPlay(lantern); // true

=== checks an exact value; && requires both checks to pass. The lantern returns true. That result approves a cue; it does not switch on a lamp or run a show.

  1. Change available to false. Predict the result before checking it.
  2. Restore availability and change sound to true. You have made the bell's case.
  3. Remove the sound field. Decide whether incomplete information should count as permission.
Compare the three results

All three return false. The last case matters: a missing field is not exactly false, so the rule refuses a cue whose sound status is unknown. These examples assume the input is a cue object; accepting other input types would need a separate contract.

Keep: the function and an input/output pair for each change. Give the whole cue collection a shape, or turn your predictions into repeatable checks.