title: JavaScript to CoffeeScript Error
body: <p>I have a function that toggles all of the others checkboxes when the last checkbox is clicked.</p>
  
  <p>It works perfectly in ordinary JavaScript:</p>
  
  <pre><code>$(document).ready(function() {
    $('#manage').click(function(event) {   
        if(this.checked) {
            $('.checkbox:checkbox').each(function() {
                this.checked = true;                        
            });
        }
        if(!this.checked) {
            $('.checkbox:checkbox').each(function() {
                this.checked = false;                        
            });
        }
    });
  });
  </code></pre>
  
  <p><a href="http://jsfiddle.net/PauaN/9/" rel="nofollow">http://jsfiddle.net/PauaN/9/</a></p>
  
  <p>However when I compile into CoffeeScript  (using <a href="http://js2coffee.org/" rel="nofollow">http://js2coffee.org/</a> ) the functionality breaks when the checkboxes are toggled off:</p>
  
  <pre><code>$(document).ready -&gt;
    $("#manage").click (event) -&gt;
      if @checked
        $(".checkbox:checkbox").each -&gt;
          @checked = true
  
      unless @checked
        $(".checkbox:checkbox").each -&gt;
          @checked = false
  </code></pre>
  
  <p><a href="http://jsfiddle.net/FRs5d/7/" rel="nofollow">http://jsfiddle.net/FRs5d/7/</a></p>
  
  <p>I think this is because the second each loop is only running once.</p>
  
  <p>What's going wrong? </p>