Kotlin supports basic data types such as integers, floats, strings and doubles using the Int, Float, String and Double keywords, respectively. Moreover, Kotlin supports arrays with the help of the arrayOf() function. So, in order to create an array of integers named myInts, you should employ the following Kotlin statement:
Additionally, Kotlin enables you to create arrays using a function that’s used for generating each element of the array:
Kotlin offers its own array classes for the primitive types. As a result, we have ByteArray, CharArray, ShortArray, LongArray, IntArray, BooleanArray, DoubleArray and FloatArray. Worth mentioning is the Unit type that’s used in the section of this tutorial, which talks about functions. The Unit type is equivalent to the void type that can be found in C and Java programming languages.…
