+ 1

Adding a value to an array

How do I add a value to an array container. For example, if an array has three values how can I add another. I know you can change a value through it's index now how can i add another value?

23rd Jan 2022, 2:22 PM
Austin Nzioka
Austin Nzioka - avatar
2 Answers
+ 2
Arrays in Kotlin have a fixed size. So you can't do that simple. But here you will find differend ways to do that. And maybe it's an idea to just use a MutableList instead of an Array. https://www.techiedelight.com/add-new-element-array-kotlin/
23rd Jan 2022, 3:23 PM
Coding Cat
Coding Cat - avatar
+ 2
Thanks
23rd Jan 2022, 3:30 PM
Austin Nzioka
Austin Nzioka - avatar