title: How to deal with Some[String] parameters?
body: <p>I have the following code, but I want to make it more idiomatically correct. First of all I define three variables as <code>Option[String]</code>.</p>
  
  <pre><code>var p1 = None : Option[String]
  var p2 = None : Option[String]
  var p3 = None : Option[String]
  </code></pre>
  
  <p>Then I define these parameters using the function <code>getParameters()</code>. Basically this function simply reads parameters from text file.</p>
  
  <pre><code>getParameters()
  //...
  
  def getParameters(): Unit = {
      val p1 = Some(getP1())
      val p2 = Some(getP2())
      val p3 = Some(getP3())
  }
  </code></pre>
  
  <p>Finally, right after <code>getParameters()</code> I run another function <code>getRules</code> that uses <code>p1</code>, <code>p2</code> and <code>p3</code>. Now it expects them to be <code>String</code> instead of <code>Some[String]</code>.</p>
  
  <pre><code>val df = getRules(p1,p2,p3)
  </code></pre>
  
  <p>If any of these three parameters is <code>None</code>, then the program should throw an error. I wonder if I am on the right way. What is the number of parameters is bigger, e.g. 10 or 15? What is the best short way to process these parameters?</p>