2 types of arrays?


#1

I was wondering what is the difference and when would I use an Associated Array, as to an Array.

I'm on the last exercise and I see that an Associated Arrary uses { }. and the properties are seperated by a comma.

I "thought" I was getting to know Arrays [ ], but this came up.

Any info on the difference between the two is greatly appreciated.

thanks.


#2

Think of an array as a list of things, whereas an Associated Array is a list of keys. Example:

Example of list:    var list = [thing1, thing2, thing3];
Example of keyed list:    
var keyed_list = {
thing1 = snow_shoes,
thing2 = skis,
thing3 = ski_mask
};

A keyed list is essentially just a more detailed array.


#3

Thank you so much, this has cleared up alot for me!


#4

You're welcome! Post anytime, mention @cadecodes and I will assist you!