title: Simplest form of multithreading in scala
body: <p>So, I have a portion of code that looks like the following.</p>
  
  <pre><code>for(a &lt;- 0 until segments)
  {
      // do something with elements at index a
  }
  </code></pre>
  
  <p>What is the simplest type of multithreading, that can allow me to execute each element of that loop in a separate thread. I also have global collections (indexed by a) that need to be accessed by each thread. All I see on the internet are futures and actors, but they are quite difficult to grasp. I want something as simple as OpenMP.</p>
  
  <p>I tried the following, but it gave me the error, <code>';' expected but '.' found. }} thread.start</code>.</p>
  
  <pre><code>for (a &lt;- 0 until segments) {
      val thread = new Thread {
          override def run {
              // do something with elements at index a
          }} thread.start
  }
  </code></pre>