title: Scala method chaining - hello world
body: <p>I'm currently learning method chaining. I've provided a working python example.</p>
  
  <pre><code>#!/bin/python3
  import sys
  
  class Generator(object):
  
      def __init__(self):
          return None
  
      def echo(self, myStr):
          sys.stdout.write(myStr)
          return self
  
  g = Generator()
  g.echo("Hello, ").echo("World!\n")
  </code></pre>
  
  <p>But the Scala version doesn't seem to work, no text is being output. </p>
  
  <pre><code>#!/usr/bin/env scala
  
  final class Printer() {
    def echo(msg: String): this.type = {
      println(msg)
      this
    }
  }
  
  class Driver {
    def main(args: Array[String]) {
      var pr = new Printer();
      pr.echo("Hello, ").echo("World!")
    }
  }
  </code></pre>
  
  <p>Does anybody know why the scala version is not working and why?</p>