Does the concept of "an array of exactly 4 element...
# getting-started
r
Does the concept of "an array of exactly 4 elements" exist in the kotlin type system? As an argument to my function.
l
Size is not a part of the type system in Kotlin. You can pass in an Array, but can’t specify the size. I would make a class called Array4 or something with a constructor that takes in 4 elements.
r
Went for a
require
instead, not as nice, but should do
k
If your array required 2 or 3 elements, you could have used
Pair
or
Triple
. But there's no
Quadruple
.