Adding a value to an array | Sololearn: Learn to code for FREE!

+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?

1/23/2022 2:22:45 PM

Austin Nzioka

2 Answers

New Answer

+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/

+2