ELI5: Explain Like I'm 5

Instance variable

Imagine you have a toy box that belongs to you, and it has many different toys inside. Now, imagine you want to keep track of how many toys are in your toy box, and you decide to write it down on a piece of paper.

That piece of paper is like an instance variable. It's a special kind of memory in a computer program that stores information about an object or thing.

So, for example, if you have a program that simulates a toy box, it might have an instance variable called "numToys" which keeps track of how many toys are currently in the box.

Every time you add or take away a toy from the box, you update the "numToys" instance variable, just like how you would update the number on your piece of paper every time you add or take away a toy from your real-life toy box.

This way, your program always knows how many toys are in the toy box, just like how you always know how many toys you have in your real-life toy box thanks to your handy piece of paper.