CompiledFrog

Post #29: Basic GDScript Arrays

Arrays in GDScript are very simple. Similar to other languages, arrays in GDScript are a collection of values. Unlike other languages, you can use different data types within the same array. For example:

var array = [8, "hello world", 32, 42]

In this example, the first value in the first position (what we call index 0) is a number. Then, in index 1, a string. Then for indexes 2-3, back to numbers.

While this example is pretty basic, arrays can get pretty complicated. But hopefully seeing one, and seeing how you can store different items in it, is helpful!