This is a simple generic method,and passing the values the args in for loop is causing an error saying:
for-loop range must have and iterator() method
fun main(args: Array<String>) {
val arr: IntArray = intArrayOf(1,2,3,4)
val charA: CharArray = charArrayOf('a','b','c','d')
printMe(arr)
printMe(charA)
}
fun <T>printMe(args: T){
for (items in args){
println(items)
}
}
how do i make it iterate throught the values for both char[] and array