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

Published on 12 May 2024 09:40 PM

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

Source code in the lasso programming language

local(
    beer = 99,
    song = ''
)
while(#beer > 0) => {
    #song->append(
        #beer + ' bottles of beer on the wall\n' +
        #beer + ' bottles of beer\n' + 
        'Take one down, pass it around\n' +
        (#beer-1) + ' bottles of beer on the wall\n\n'  
    )
    #beer--
}

#song

(with beer in 99 to 1 by -1 select
    #beer + ' bottles of beer on the wall' +
    #beer + ' bottles of beer\n' + 
    'Take one down, pass it around\n' +
    --#beer + ' bottles of beer on the wall\n'
)->join('\n')

// this example adds an "s" to bottle until there is only 1 bottle left on the wall

local(s = 's')
with n in 99 to 1 by -1 do {^
    #n + ' bottle' + #s + ' of beer on the wall,
'
#n + ' bottle' + #s + ' of beer,
'
#n = #n - 1 #s = (#n != 1 ? 's' | '') 'Take one down, pass it around,
'
#n + ' bottle' + #s + ' of beer on the wall.

'
^}

You may also check:How to resolve the algorithm Self-describing numbers step by step in the Perl programming language
You may also check:How to resolve the algorithm Conway's Game of Life step by step in the Frink programming language
You may also check:How to resolve the algorithm 100 doors step by step in the Raku programming language
You may also check:How to resolve the algorithm Last letter-first letter step by step in the PicoLisp programming language
You may also check:How to resolve the algorithm Roots of unity step by step in the VBA programming language