I have to print list elements from the end with commas in between and no comma at the end. Code:
val daysList = List("Poniedzialek", "Wtorek", "Sroda", "Czwartek", "Piatek", "Sobota", "Niedziela")
def recurencyListReverse(days:List[String], twoB:String):String =
{
if (days.nonEmpty) return recurencyListReverse(days.tail, days.head + ", " + twoB)
return twoB
}
println("Zadanie 2B)")
println(recurencyListReverse(daysList, ""))
Any ideas?