title: reading a text files in Scala
body: <p>I have been trying to read text files using Scala one line at a time</p>
  <pre><code>scala&gt; import scala.io.Source
  scala&gt; val filename = &quot;read from file&quot;
  
  scala&gt; for (line &lt;- Source.fromFile(filename).getLines)
        {
          println(line)
        }
  </code></pre>
  <p>But upon typing the the last line on the terminal,I get this error:</p>
  <pre><code>java.io.FileNotFoundException: open file scala (No such file or directory)
    at java.base/java.io.FileInputStream.open0(Native Method)
    at java.base/java.io.FileInputStream.open(FileInputStream.java:219)
    at java.base/java.io.FileInputStream.&lt;init&gt;(FileInputStream.java:157)
    at scala.io.Source$.fromFile(Source.scala:91)
    at scala.io.Source$.fromFile(Source.scala:76)
    at scala.io.Source$.fromFile(Source.scala:54)
  ... 32 elided
  </code></pre>