title: Implicit Classes in Scala
body: <p>Below is the example program for Scala Implicit Class:</p>
  
  <pre><code>object Run {
     implicit class IntTimes(x: Int) {
        def times [A](f: =&gt;A): Unit = {
           def loop(current: Int): Unit =
  
           if(current &gt; 0){
              f
              loop(current - 1)
           }
           loop(x)
        }
     }
  }
  </code></pre>
  
  <p>There is an other class that calls " <code>4 times println("hello")</code>" as following, but I can not understand " <code>4 times println("hello")</code>"  mean?</p>
  
  <pre><code>object Demo {
     def main(args: Array[String]) {
        4 times println("hello")
     }
  }
  </code></pre>