# Control

## Run / Stop

* most programs have a way to start running code and stop running code
* IDEs and editing programs will often have play, pause, and stop buttons

**Big scale example:** Opening and exiting a program

**Small scale example:** Running only under certain conditions (turning on a switch, etc.)

{% hint style="info" %}
Some programs can continuously play while you are updating the code. Be sure to see if code updated while being played is saved when it is stopped.
{% endhint %}

## Setup() and Loop()

* many languages have and require two basic blocks of code

### “Setup” function

* runs once
* only on the first frame

### “Loop” function

* runs once per frame

{% hint style="info" %}
Remember! Some computers run around 60 frames per second!
{% endhint %}

## Runs Line by Line

* when code is presented in blocks or text, the lines of code are run one at a time, in order
* node-based languages will usually run left to right, from input to output

{% hint style="info" %}
Sometimes the code appears to not run this way, but it's often due to the speed of the computer. Using small increments in values, durations, lags, waits, and pauses can help slow down visuals.
{% endhint %}
