title: Trying to code the 99 bottles of beer song
body: <pre><code>public class apples {
      public static void main(String[] args) {
          int beerNum = 99;
          String word = "bottles";
  
          while (beerNum &gt; 0) {
  
              if (beerNum == 1) {
                  word = "bottle"; // ONE bottle
              }
  
              System.out.println(beerNum + " " + word + " of beer on the wall, " + beerNum + " " + word + " of beer");
              beerNum = beerNum - 1;
  
              if (beerNum &gt; 0) {
                  System.out.println("Take one down, pass it round " + beerNum + " " + word + " of beer");
              }
          }
  
          if (beerNum == 0) {
              System.out.println("No more bottles of beer");
          }
  
      }
  }
  </code></pre>
  
  <p>The output is:</p>
  
  <pre><code>99 bottles of beer on the wall, 99 bottles of beer
  Take one down, pass it round 98 bottles of beer
  98 bottles of beer on the wall, 98 bottles of beer
  Take one down, pass it round 97 bottles of beer
  97 bottles of beer on the wall, 97 bottles of beer
  Take one down, pass it round 96 bottles of beer
  96 bottles of beer on the wall, 96 bottles of beer
  Take one down, pass it round 95 bottles of beer
  95 bottles of beer on the wall, 95 bottles of beer... 
  
  (And so on and so forth)
  
  3 bottles of beer on the wall, 3 bottles of beer
  Take one down, pass it round 2 bottles of beer
  2 bottles of beer on the wall, 2 bottles of beer
  Take one down, pass it round 1 bottles of beer
  1 bottle of beer on the wall, 1 bottle of beer
  No more bottles of beer
  </code></pre>
  
  <p>Why isn't the String word equalling "bottle"? Instead it says "bottles" in "Take one down, pass it round 1 BOTTLES of beer.</p>
  
  <p>Also after "1 bottle of beer on the wall, 1 bottle of beer" it doesn't say "Take one down pass it round"</p>
  
  <p><a href="http://www.99-bottles-of-beer.net/lyrics.html" rel="nofollow noreferrer">Link to the lyrics</a>.</p>