You should be familiar with this code, but go ahead and execute it to make sure it’s working as expected.
Let’s now make our fizzbuzz more robust and flexible.
Refactor (improve) this code by implementing a method (called fizzbuzz
) that takes in the starting and ending number so that we can programmatically change which numbers our fizzbuzz starts and ends at, instead of the usual 1 and 100.
Think about other methods that can be implemented to further refactor this code and make it more readable. Remember that readability does not necessarily mean fewer lines of code.