r/eli5_programming • • Mar 13 '19

ELI5: State?

3 Upvotes

3 comments sorted by

View all comments

Show parent comment

1

u/[deleted] Mar 14 '19

I can't put it any more simply than "state is the data present in a program at a particular moment".

The word "state" in normal usage means: "a condition; a set of circumstances applying at any given time."

Run a program. Freeze time. Look at what's currently in RAM. That's your state.

Run mspaint. Pick the spray tool. Click around to make some sprays. After you've done that, the state of the program is more or less:

  1. "The currently selected tool is the spray tool."
  2. "The mouse is not being clicked."
  3. "The canvas contains mostly white pixels, with some black pixels at the following coordinates: ..."