As mentioned before, every programming has a large number of building blocks. These building blocks can all be understood separately as individual parts. One of those building blocks is the array; one of the most used building blocks. So, let’s talk about arrays!
What Is An Array
Arrays have many names, but in most languages, they are structurally a list. So, they allow you to create lists of items. Consider then an example where you need to keep track of all your enemies in games; lists would work well for this as they come with useful methods for tracking information.
The methods of the Array are the true star of the show. Methods are the array’s form of operations; this is similar to how primitive data types have operations(like adding two numbers together). They allow you to perform specific tasks. Some standard tasks are sorting, slicing(creating a new list from parts of the old list), pushing (adding elements to the end of the list), popping(removing an element from the end of the list), and searching(finding an element in the list). All of these can be extremely useful to you. For example, maybe you want to know which enemies are alive? You can do that by checking the array. That’s one of many reason’s why they’re valuable structures. Lastly, they allow you to keep from repeating yourself.
What’s The Point
Why learn about arrays? Why learn all of these standard structures? The answer is simple; you will make your job a lot harder. Don’t do that to yourself; the point of learning this is to have the tools to make your game faster rather than struggle.
Collect the most important tools, so that you can reduce all the unnecessary you have to learn along the way. We’re here trying to help you clarify the path. Take care.
Tune in next time, where we’ll go into the applications of arrays.