By: Dan Stewart
October 4, 2017
MIT License

Let’s build on the generic list refactor and remove the else statements to create guard clauses. The use of a guard clause is up for debate. Some believe in the single entry, single exit approach to writing methods. The great thing about Katas is that you can experiment and see which you like best.

BowlingGame/Game.cs

public int Score()
{
    var roll = 0;
    for ( var frame = 0; frame < 10; frame++ )
    {
        if ( Strike( roll ) )
        {
            score += StrikeBonus( roll );
            roll++;
            continue;
        }

        if ( Spare( roll ) )
        {
            score += SpareBonus( roll );
            roll += 2;
            continue;
        }

        score += NormalScore( roll );
        roll += 2;
    }

    return score;
}