Knowing this, you can work out that the last element’s index is the number of values in the array less 1. The elements in the array are zero-indexed, which means the index of the first element is 0, the index of the second element is 1, and so on. What is an array?Īn array is an ordered collection of values of the same type. Arrays are typed, just like regular variables and constants, and store multiple values in a contiguous portion of memory.īefore you create your first array, take some time to consider in detail what an array is and why you might want to use one. ArraysĪrrays in Kotlin correspond to the basic array type available in Java. Two of the most common collections types in Kotlin are arrays and lists.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |