title: FreeMarker error: For "-" left-hand operand: Expected a number, but this has evaluated to a string
body: <p>I am trying to compute sum of values in map and print line of "-"s (the length of this line should be sum-1).
  This is the code of my function:</p>
  
  <pre><code>&lt;#function getSeparatorLine map&gt;
      &lt;#if !map?has_content&gt;
          &lt;#return ""&gt;
      &lt;/#if&gt;
      &lt;#local borderLength = 0&gt;
      &lt;#list map?keys as item&gt;
          &lt;#local borderLength = borderLength + item + 1&gt;
      &lt;/#list&gt;
      &lt;#return ""?right_pad(borderLength - 1, "-")&gt;
  &lt;/#function&gt;
  </code></pre>
  
  <p>I get a freemarker error saying:</p>
  
  <pre><code>ERROR freemarker.runtime - Error executing FreeMarker template
  freemarker.core.NonNumericalException: For "-" left-hand operand: Expected a number, but this has evaluated to a string (wrapper: f.t.SimpleScalar):
  ==&gt; borderLength  [in template "negative_events_report.template" at line 38, column 27]
  </code></pre>
  
  <p>Any suggestions?</p>