Classes, structures, and enumerations can define subscripts, which are shortcuts for accessing the member elements of a collection, list, or sequence. You use subscripts to set and retrieve values by index without needing separate methods for setting and retrieval. For example, you access elements in an Array instance as someArray[index]and elements in a Dictionary instance as someDictionary[key]. You can define multiple subscripts […]
Let’s make an example to understand better the scope of this tutorial. You want to: increment all numbers in array by 1 double all numbers in array check if the numbers in array are even or odd multiply all numbers in array more and more… How many functions should you create to do this?