title: functions declaration in data class Kotiln
body: <p>In Kotlin, I wanted to write a function, but I see the new way of writing it with "<code>val</code>" property using <code>get()</code>. What's the difference between the below two.</p>
  
  <pre><code> 1)   fun sample(): String {
               return "text"
             }
  
     2)  val sample: String
              get() = "text"
  </code></pre>