You’ll often need multiple variables of the same type and while you can sometimes just create separate variables with their own names, what if you don’t know ahead of time how many will be needed?

Even if you do know how many variables are needed, sometimes there are just too many to give each one it’s own name. If you need a hundred bools, do you really want to work with them individually as doorOpen01, doorOpen02, etc.? No. Because this makes your code brittle and completely tied to that specific scenario. How many buildings do you know that have exactly 100 doors?

You want your code to be able to work with multiple doors and know if they’re open or closed. But you don’t want to tie it to any specific number. By making your code independent, it can then work on buildings with no doors at all up to giant palaces with thousands of doors.

Arrays let you work with multiple data types. You can still access each element individually. You just don’t need to give each one its own name that the compiler knows about and must track.

You can also declare multidimensional arrays that have 2 or more indexes.

How many items are in the array or can be in the array is very important. But it’s not always part of the type. There are some programming languages like C++ where this is part of the type. So an array of 3 ints is a completely different data type than an array of 4 ints. But even C++ can allow some unwanted flexibility here.