title: Writing a Sass/Scss function that returns a string
body: <p>I'm trying to optimise CSS-related calculations using two custom utility functions in Scss.</p>
  
  <p>One for EMs:</p>
  
  <pre><code>@function _em($wanted, $inherited) {
    @return ($wanted / $inherited) + 'em';
  }
  </code></pre>
  
  <p>...and another for percentages:</p>
  
  <pre><code>@function _pc($wanted, $parent) {
    @return (($wanted / $parent) * 100) + '%';
  }
  </code></pre>
  
  <p>...then calling them inline:</p>
  
  <pre><code>body {
    margin: _pc(40,1024);
    font-size: _em(20,16);
    line-height: _em(26,20);
  }
  </code></pre>
  
  <p>Neither of these are returning the expected <code>Nem</code> or <code>N%</code> string, however. <em>(I think it's my string concatenation - i.e. gluing the unit declarative on the end of the calculation - but I'm not sure.)</em></p>
  
  <p>Can anyone shed any light on what I'm doing wrong?</p>