I am trying to learn Kotlin.
I have an array: [1,2,3,4,5]
How can I print the squares of each of the numbers in an array?
For example, in Python, I could just do:
array = [1,2,3,4,5]
print(" ".join (str(n*n) for n in array))
But I'm not sure how to do this in Kotlin
source
share