title: Play framework: How do I print index number inside scala template by using map
body: <p>Hi I am pretty new in play framework and scala, continue I am reading the play documentation but I am facing problem while printing the index inside the map in the scala template file. I have tried below code but it was not working for me.</p>
  
  <p>//Attempt 1: But not working</p>
  
  <pre><code>@(customer: Customer, orders: Seq[Order])
  &lt;h1&gt;Welcome @customer.name!&lt;/h1&gt;
  
  &lt;ul&gt; 
  @orders.map { case(index,order) =&gt;
    &lt;li&gt;@index&lt;/li&gt;
    &lt;li&gt;@order.title&lt;/li&gt;
  } 
  &lt;/ul&gt;
  </code></pre>
  
  <p>//Attempt 2: But not working</p>
  
  <pre><code>@(customer: Customer, orders: Seq[Order])
  &lt;h1&gt;Welcome @customer.name!&lt;/h1&gt;
  
  &lt;ul&gt; 
  @orders.map { order =&gt;
    &lt;li&gt;@order.index&lt;/li&gt;
    &lt;li&gt;@order.title&lt;/li&gt;
  } 
  &lt;/ul&gt;
  </code></pre>
  
  <p>Please give me some solution for this or give something other reference/resource link for play where I can explore more. You can find the above example from <a href="http://www.playframework.com/documentation/2.0.1/ScalaTemplates" rel="nofollow">play documentation</a>.</p>