I am trying to do an exercise in which we have to define a recursive function that is able to return a string with all the vowels of a string using another function that indicates whether a Char is 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={}
I find it hard to see if the vocal function can be done recursively since it needs yes or yes of the esVocal function because it is the one that checks the letters one by one but I can not find a valid solution without being fill the pile or do strange things, thanks in advance.