title: scala - uninitialized variable declaration
body: <p>I have a variable in one of my scala classes, whose value is only set for the first time upon calling a specific method. The method parameter value will be the initial value of the field. So I have this:</p>
  
  <pre><code>classX {
    private var value: Int= _
    private var initialised = false
  
    def f(param: Int) {
      if (!initialised){
        value = param
        initialised = true
      }
    }
  }
  </code></pre>
  
  <p>Is there a more scala-like way to do this? Options seem a bit too cumbersome...</p>