title: In scala, use function name as return value?
body: <p>I am confused when I first come across the following piece of code.</p>
  
  <p>In the class Element, there are three function definitions.</p>
  
  <p>Why height and width can use contents directly as a variable of Array[String]?</p>
  
  <p>Is it because every function in Scala is an object or some other rule?</p>
  
  <p>I come from C++ world, so the definition really puzzles me.</p>
  
  <pre><code>abstract class Element {
    def contents: Array[String]
    def height: Int = contents.length
    def width: Int = if (height == 0) 0 else contents(0).length
  }
  </code></pre>