Programming Basics #34 Collections in Languages
Programming Course. The Basics of Programming.
#34 Collections in Languages

Learn to code.

Collections in other languages

Java_script allows anything in any element in the array. Numbers, strings, booleans or even elements undefined. Supports mixed data. But many languages, only allow specific kinds of data in an array. It is an array of strings, or an arrays of integers. You can’t have both in the same array.

Similarly java_script allows us to create an array for example with three elements, and we can then add more to it, or even subtract from.

But other languages may want your arrays to be a fixed size. You have to know how big he is before you make it.

If you make an array of five elements long, you can’t change it, after has been made.

So there’s something called mutable, versus a immutable object.

If something is mutable, he can mutate, can change.

If something is immutable, is something that cannot change, after it was been created.

So in a quite a lot of languages, you actually choose if you want a mutable, or immutable array.

Now you may ask. Wy should i can have a flexibility of this. One that i can change, can substrate or add to.