Skip to content

Instantly share code, notes, and snippets.

@ga2arch
Created September 11, 2011 20:13
Show Gist options
  • Save ga2arch/1210059 to your computer and use it in GitHub Desktop.
Save ga2arch/1210059 to your computer and use it in GitHub Desktop.
Scala exp
object Apple1 extends App {
val vowels = Array('a', 'e', 'i', 'o', 'u')
println("Type a phrase")
val phrase = Console.readLine().toLowerCase
val vowel = phrase.find(vowels.contains(_)).getOrElse()
val newP = phrase.map(x => if (vowels.contains(x)) vowel else x).mkString
println(newP)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment