scala> val x = "scala is awesome" x: java.lang.String = scala is awesome scala> x.reverse res1: String = emosewa si alacs
def reverse(s: String) : String = (for(i <- s.length - 1 to 0 by -1) yield s(i)).mkString