I am trying to do an exercise in which you have to define a recursive function that is capable of returning a string with all the vowels of a string using another function that indicates if a Char is a vowel or not:
object ej8 {
def esVocal(letra:Char):Boolean={
var vocal:Boolean=false
if(letra=='a' || letra=='e' || letra=='i' || letra=='o' || letra=='u')vocal=true
return vocal
}
def vocales(cadena:String): String={}
It is quite difficult for me to see if the vowel function can be done recursively since it needs yes or yes from the esVocal function since it is the one that checks the letters one by one but I cannot find a valid solution without filling the stack or do weird things, thanks in advance.