title: Is it possible to declare a val before assignment/initialization in Scala?
body: <p>In general, can you declare a val in scala before assigning it a value? If not, why not? An example where this might be useful (in my case at least) is that I want to declare a val which will be available in a larger scope than when I assign it. If I cannot do this, how can I achieve the desired behavior?</p>
  
  <p>And I want this to be a val, not a var because after it is assigned, it should NEVER change, so a var isn't ideal.</p>
  
  <p>For example:</p>
  
  <pre><code>object SomeObject {
      val theValIWantToDeclare // I don't have enough info to assign it here
  
      def main(): Unit = {
          theValIWantToDeclare = "some value"
      }
  
      def someOtherFunc(): Unit {
          val blah = someOperationWith(theValIWantToDeclare)
      }
  }
  </code></pre>