[SOLVED] How to use square brackets?

I found this
https://wiki.gdevelop.io/gdevelop5/all-features/variables/#accessing-child-variables-in-structures-or-arrays

But i do not understand much from it

Can someone explain to me how to use square brackets?
And provide few examples?
And explain how they are different from angled brackets?

Its actually Math Related. Well,you might know that when you want to use a bracket in a bracket you use some other brackets like{} or the square brackets, and here you use them for a variable that is already part of a variable. Lets take a mother for example.She is recognized by ().And she gives a child.But You cannot use the same brackets for a little boy and call him a mother.So you Use different brackets (Square brackets) For The child.Here if you used() for “level1score” and “level2score”.Then Gdevelop would entirely think of them as individual proper global or scene variable but it would not find any because they are not there.Instead they are actually there as part of another variable “Player1”.
Get it??

I like to think about variables as none other than name tags

Cause you can write anything on them and depending on what you see you can order different stuff to ppl

So if i follow what you wrote correctly let’s say Mother as parent variable would have red name tag round brackets
But all child variables of it would need to have blue name tag a square brackets

Because if i would use for child red name tag same as i did for mother
Gdevelop would think i am referring another parent variable and not child variable of parent variable i just referred outside of brackets?

Yes no?

You use the square brackets on a structure or array to indicate which child element to reference. For arrays, the value in the square brackets denotes the array index and is always a number. For structures, the square brackets contain the name of the child element, and is a string (contained within quotes).


For example:

If you have an array named colours with items (“Red”, “Green”, “Blue”, “Indigo”, “Yellow”), then colours[1] would give “Green” (because arrays are zero-indexed, meaning the first element is always at index 0). Arrays can be considered as stack, in which there is an order to the data.

If you have a structure named player with elements (“name” : “Bob”, “occupation” : “Builder”, “hat” : “hard hat”), then player["occupation"] would give “Builder”. Structures can be compared to a bag of tags, with a tag for each bit of information (so one for “name”, another for "occupation etc), and where the order that they appear is not important.


(As a side note, in other programming languages the structure are commonly called a dictionary, with the element name and data being referred to as the key and value, giving rise to the term key-value pairing because you use the key to obtain the value it’s been paired with)

@MrMen @Phoenix

Ok thx guys now i get how to use square brackets