I am new to Kotlin. I am simply trying to return a response as a String from a method. But if I use val Str = ""; it is not re-assignable.
Like Java in why can't we re-assign a response to a String which is defined already, and return it.
public fun getCustomers(): String {
val Str = null;
val StringRequest = StringRequest(Request.Method.GET, url, Response.Listener<String> { response ->
Str = response.toString();
}, Response.ErrorListener {
it.printStackTrace();
})
return Str;
}