/ scala

Scala 005 String character counter

The task was to create a solution which would tell you how many characters are in a string.

Quick Solution

stringVariable.length

My Solution

object stringElements  {
  def main(arg: Array[String])  {
    var input = ""
    while (input != "q")  {
      input = readLine("Please enter a string: ")
      println("\nYou entered: " + input + "\nThis contains " + input.length + " characters.")
    }
  }
}