Skip to content

Instantly share code, notes, and snippets.

@kmizu
Created July 6, 2010 16:11
Show Gist options
  • Save kmizu/465582 to your computer and use it in GitHub Desktop.
Save kmizu/465582 to your computer and use it in GitHub Desktop.
def hasA(s: String): Boolean = {
def hasA(i:int, s:String):boolean = {
if(i == s.length) return false
if(s(i) == 'a') return true
return hasA(i + 1, s)
}
hasA(0, s)
}
hasA("abc")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment