title: Pad binaries in elixir by a variable amount
body: <p>I need a function that can produce a binary that consists of a certain number of 0 octets. I though the following would be possible</p>
  
  <pre><code>def padding(length) do
    bits = length * 8
    &lt;&lt;0::bits&gt;&gt;
  end
  </code></pre>
  
  <p>OR</p>
  
  <pre><code>def padding(length) do
    &lt;&lt;0::binary-size(length)&gt;&gt;
  end
  </code></pre>
  
  <p>Both of these fail with an argument error. Why is it not passible to pass a variable to create a binary in elixir. It looks from this link like it would be possible in erlang. <a href="http://erlang.org/pipermail/erlang-questions/2008-December/040703.html" rel="nofollow noreferrer">http://erlang.org/pipermail/erlang-questions/2008-December/040703.html</a></p>
  
  <p>Also what would be a simple way to implement this function in Elixir</p>