title: Dynamic :last-child in SASS
body: <p>I've been messing around with SASS for a while and have made some nice functions that makes use of @if @else if etc. However I have the following two pieces of code on a Mixin:</p>
  
  <pre><code>&amp;:last-child { float: right; margin-right: 0; } 
  &amp;:only-child { float: left; margin-right: 0; }
  </code></pre>
  
  <p>This obviously applies both of these pieces of code to every element I include this particular Mixin on. Is there a way of dynamically checking whether an element is a :last-child / :only:child with an @if statement or any other methods?</p>
  
  <p>Something like:</p>
  
  <pre><code>@if :last-child == True { float: right; margin-right:0; }
  </code></pre>
  
  <p>Hopefully I've explained that well enough.</p>
  
  <p>Thanks</p>