title: Does ruby's case statement fall through?
body: <p>I am writing a hangman game in ruby and I wanted to use a case statement to determine which body part to place corresponding to a number of incorrect guesses. I made this game using a board class I use for other games like chess and connect-4 because I have a method which serializes the board class allowing me to save and load the game without any extra code. For the game to be saved, I needed some way of determining the number of incorrect guesses for the hangman without adding extra variables to the board class. To solve this I used an instance variable on the board class called history, which can be used to push moves from the game to the boards history. When the board gets serialized, the history is saved as well, which can be read by the game and used to determine incorrect guesses. </p>
  
  <p>In the hangman game, I have a method called read history (which I use for all the games since it solves the serialization issue described above). The read_history method is responsible for reading the past guesses, display them, and determine the number of incorrect guesses. This number is then passed to a hang method which determines which body parts of the hangman to add.</p>
  
  <pre><code>def hang(incorrect)
      case incorrect
      when 0 
          @hangman = ["   ", "   ", "   "]
          break
      when 7 
          @hangman[2][2] = '\\'
      when 6
          @hangman[2][0] = '/'
      when 5
          @hangman[2][1] = '*'
      when 4
          @hangman[1][2] = '\\'
      when 3
          @hangman[1][0] = '/'
      when 2 
          @hangman[1][1] = '|'
      when 1
          @hangman[0][1] = 'o'
      end
  end
  </code></pre>
  
  <p>If I were writing this in java, and a value of 5 were passed to the above method, it would read the statement until it hit "when 5" or in java terms "case 5:". It would notice that there is not a break in the statement and will move down the list executing the code in "case 4:" and repeating until a break is found. If 0 were passed however it would execute the code, see the break, and would not execute and other statements.</p>
  
  <p>I am wondering if Ruby is capable of using case statements the way java does in the way that they fall through to the next statement. For my particular problem I am aware that I can use a 0.upto(incorrect) loop and run the cases that way, but I would like to know the similarities and differences in the case statement used in ruby as opposed to the switch-case used in java</p>