Sha256: 8e7b8606369201d7796286b5384df96d6cf78bcc3166c73e82cd1a2bd17a874c

Contents?: true

Size: 1.01 KB

Versions: 28

Compression:

Stored size: 1.01 KB

Contents

using System.Linq;

public static class BeerSong
{
    public static string Verse(int number)
    {
        switch (number)
        {
            case 0:
                return "No more bottles of beer on the wall, no more bottles of beer.\nGo to the store and buy some more, 99 bottles of beer on the wall.";
            case 1:
                return "1 bottle of beer on the wall, 1 bottle of beer.\nTake it down and pass it around, no more bottles of beer on the wall.";
            case 2:
                return "2 bottles of beer on the wall, 2 bottles of beer.\nTake one down and pass it around, 1 bottle of beer on the wall.";
            default:
                return string.Format("{0} bottles of beer on the wall, {0} bottles of beer.\nTake one down and pass it around, {1} bottles of beer on the wall.", number, number - 1);
        }
    }

    public static string Recite(int startBottles, int takeDown)
        => string.Join("\n\n", Enumerable.Range(startBottles - takeDown + 1, takeDown).Reverse().Select(Verse));
}

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/csharp/exercises/beer-song/Example.cs
trackler-2.2.1.179 tracks/csharp/exercises/beer-song/Example.cs
trackler-2.2.1.178 tracks/csharp/exercises/beer-song/Example.cs
trackler-2.2.1.177 tracks/csharp/exercises/beer-song/Example.cs
trackler-2.2.1.176 tracks/csharp/exercises/beer-song/Example.cs
trackler-2.2.1.175 tracks/csharp/exercises/beer-song/Example.cs
trackler-2.2.1.174 tracks/csharp/exercises/beer-song/Example.cs
trackler-2.2.1.173 tracks/csharp/exercises/beer-song/Example.cs
trackler-2.2.1.172 tracks/csharp/exercises/beer-song/Example.cs
trackler-2.2.1.171 tracks/csharp/exercises/beer-song/Example.cs
trackler-2.2.1.170 tracks/csharp/exercises/beer-song/Example.cs
trackler-2.2.1.169 tracks/csharp/exercises/beer-song/Example.cs
trackler-2.2.1.167 tracks/csharp/exercises/beer-song/Example.cs
trackler-2.2.1.166 tracks/csharp/exercises/beer-song/Example.cs
trackler-2.2.1.165 tracks/csharp/exercises/beer-song/Example.cs
trackler-2.2.1.164 tracks/csharp/exercises/beer-song/Example.cs
trackler-2.2.1.163 tracks/csharp/exercises/beer-song/Example.cs
trackler-2.2.1.162 tracks/csharp/exercises/beer-song/Example.cs
trackler-2.2.1.161 tracks/csharp/exercises/beer-song/Example.cs
trackler-2.2.1.160 tracks/csharp/exercises/beer-song/Example.cs