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

Published on 12 May 2024 09:40 PM

How to resolve the algorithm 99 bottles of beer step by step in the Slate 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 Slate programming language

Source code in the slate programming language

n@(Integer traits) bottleVerse
[| nprinted |
  nprinted: n printString ; ' bottle' ; (n > 1 ifTrue: ['s'] ifFalse: ['']) ; ' of beer'.
  inform: nprinted ; ' on the wall.'.
  inform: nprinted.
  inform: 'Take one down, pass it around.'.
  inform: nprinted ; ' on the wall.'.
].

x@(Integer traits) bottles
[
  x downTo: 0 do: #bottleVerse `er
].

99 bottles.

  

You may also check:How to resolve the algorithm Even or odd step by step in the 0815 programming language
You may also check:How to resolve the algorithm Monty Hall problem step by step in the X++ programming language
You may also check:How to resolve the algorithm Jensen's Device step by step in the F# programming language
You may also check:How to resolve the algorithm Roots of a quadratic function step by step in the J programming language
You may also check:How to resolve the algorithm Comments step by step in the DWScript programming language