+ 4
How to print Matrix(2D Array) in Kotlin?
I have searched alot and didn't find any way to print Matrix in Kotlin like we do in Java. I was trying to make a simple Tic Tac Toe game but and then i stucked on to make a matrix in Kotlin using 2d array.
3 Respuestas
+ 3
Abhishek Jain really helpful & thanks a lot for this. 😍
+ 2
joinToString method is also great at dealing with matrices. It automatically places user specified strings before, during, and after the list. It can perform transformations on the data (e.g. replace zero cells as spaces.)
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/join-to-string.html