How to resolve the algorithm 99 bottles of beer step by step in the MOO programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm 99 bottles of beer step by step in the MOO programming language

Table of Contents

Problem Statement

Display the complete lyrics for the song:     99 Bottles of Beer on the Wall.

The lyrics follow this form: ... and so on, until reaching   0     (zero). Grammatical support for   1 bottle of beer   is optional. As with any puzzle, try to do it in as creative/concise/comical a way as possible (simple, obvious solutions allowed, too).

Let's start with the solution:

Step by Step solution about How to resolve the algorithm 99 bottles of beer step by step in the MOO programming language

Source code in the moo programming language

bottles = 99;
while (bottles > 0)
  unit = (bottles == 1 ? "bottle" | "bottles");
  player:tell(bottles, " ", unit, " of beer on the wall.");
  player:tell(bottles, " ", unit, " of beer.");
  player:tell("Take one down, pass it around.");
  bottles = bottles - 1;
endwhile
player:tell("0 bottles of beer on the wall.");

  

You may also check:How to resolve the algorithm Almost prime step by step in the Kotlin programming language
You may also check:How to resolve the algorithm Smarandache-Wellin primes step by step in the Phix programming language
You may also check:How to resolve the algorithm Strong and weak primes step by step in the Sidef programming language
You may also check:How to resolve the algorithm Best shuffle step by step in the Raku programming language
You may also check:How to resolve the algorithm Character codes step by step in the Lang5 programming language