title: Ruby Koans Scoring Project. undefined method `length' for nil:NilClass
body: <p>I am BRAND new to Ruby, and programing in general. I'm working my way through the Ruby Koans. I've made it up to 176/274 before getting stuck.<br>
  It's the "Scoring Project" I need to write a method to calculate the score of a given dice roll.<br>
  This may not be the most elegant code you've ever seen but here's what I came up with:</p>
  
  <pre><code>def score(dice)
    tally = 0
    tally += (dice.sort.to_s[/[1]+/].length % 3) * 100
    if dice.sort.to_s[/[1]+/].length &gt;= 3
      tally += 1000
    end
    tally = tally + (dice.sort.to_s[/[5]+/].length % 3) * 50
    if dice.sort.to_s[/[5]+/].length &gt;= 3
      tally += 500
    end
    if dice.sort.to_s[/[2]+/].length &gt;= 3
      tally += 200
    end
    if dice.sort.to_s[/[3]+/].length &gt;= 3
      tally += 300
    end
    if dice.sort.to_s[/[4]+/].length &gt;= 3
      tally += 400
    end
    if dice.sort.to_s[/[6]+/].length &gt;= 3
      tally += 600
    end
    return tally
  end
  </code></pre>
  
  <p>The first test is: score([]) needs to return 0</p>
  
  <p>When I run it I get "undefined method `length' for nil:NilClass" (the line referenced is the first instance of .length)
  This tells me that "dice.sort.to_s[/[1]+/]" with "score([])" is nil, but when i run it in irb>> it is 0.</p>
  
  <p>What gives?</p>