Back to Hello SparksHello Sparks glossary

Glossary

Rule

A rule is an instruction a person writes for a program: when something happens, and maybe if something is true, do something. The program follows it exactly.

Rules and models are two ways to make a program decide. A person writes every rule. A model learns from examples instead. Many apps use both: a model to recognise something, and rules to decide what happens next.

Written, not learned
  1. The model guesses “rain”
  2. Rule: WHEN rain, DO add 3 water
  3. Water goes up by 3

These pictures show the idea. They are drawings, and nothing in them is running.

Examples

  • In a lessonIn Spell Garden, Rules

    Each rule has a WHEN, an optional IF and a DO. The model only guesses which spell you drew. Your rules decide what that spell does.

  • Possibility, not builtA game character

    A character could use a language model to choose what to say, while rules decide when it can open a door.

Keep in mind

  • A rule does exactly what it says, every time, even when that is not what you meant.
  • A rule runs only when its WHEN happens.

Related words

Where you can try it

Spell Garden, Rules: add a rule, then cast a spell and watch it run.

All glossary words