I first learnt about the FizzBuzz code challenge in one of Tom Scott’s YouTube videos and it’s stuck with me ever since. The problem is so simple to explain, but can be achieved so many different ways and the way you choose to approach it can say a lot about your code development style and skill level.

## Here is how the FizzBuzz Challenge works

Develop some code that outputs each number from 1 to 100 (on a new line for each record).

For multiples of 3, replace the number with “Fizz”.

For multiples of 5, replace the number with “Buzz”.

And for numbers which are multiples of both 3 and 5, output “FizzBuzz” instead of the number.

For example, the first 20 outputs would look like this:

- 1
- 2
- Fizz
- 4
- Buzz
- Fizz
- 7
- 8
- Fizz
- Buzz
- 11
- Fizz
- 13
- 14
- FizzBuzz
- 16
- 17
- Fizz
- 19
- Buzz

## The FizzBuzz Challenge in AMPscript

The internet is littered with solutions to the original FizzBuzz code challenge, and while there is a lot to learn from reading how other people have solved this problem, the most value will be gained by attempting it yourself! So here is my alteration on the FizzBuzz Challenge – called “FizzBuzzBoingBang” – for you to try using AMPscript in Salesforce Marketing Cloud:

Develop some code that outputs each number from 1 to 1000 (on a new line for each record).

For multiples of 3, replace the number with “Fizz”.

For multiples of 5, replace the number with “Buzz”.

For multiples of 7, replace the number with “Boing”.

For multiples of 11, replace the number with “Bang”.

When a number meets multiple conditions, the output should be in the above display order without spaces.**For example**: 21 would be “FizzBoing”, 55 would be “BuzzBang”, and 1155 would be the first instance of “FizzBuzzBoingBang”.

If you’re looking for some tips on how to approach this challenge, take a look at the AMPscript Mod() function. I explain how this and other math function works in my AMPscript Math Functions video!

# Competition: Smallest Solution to FizzBuzz in AMPscript

Now for some fun – lets see how small you can make your AMPscript code to solve the “FizzBuzzBoingBang” challenge above. Submit your code entry using the Competition Forms Link below. The winning solutions will be announced publicly on social networks at the end of the competition.

The purpose of this competition is to __have fun in AMPscript__ and to identify, celebrate and learn from AMPscript experts – for the benefit of the community. There are no “prizes” to be won, other than the social gratification gained from authoring a winning solution to this challenge.

### Competition Entry Conditions

- Submissions will be collected via Google Forms. Only 1 submission per person.
- Competition opens on
**September 13**, and closes on**September****30**. Or put more simply, if the Google Forms link doesn’t work, the competition is closed. - Submissions that do not comply with the Competition Rules (Below) will be excluded.
- The information you submit in the form (solution code, name and social links) will be curated and shared publicly for other trailblazers to view and learn from.
- Winning and noteworthy submissions will be publicised on social networks including but not limited to LinkedIn, Twitter, YouTube, etc. to give credit/kudos/praise to the code authors.

### Competition Rules

- The winner will be the code author who submits the shortest AMPscript code snippet that achieves the required output (see below). Code submissions that fail to produce the required output will be disqualified.
- Your code must be fully self-contained AMPscript, able to copied and run on a CloudPage. Your code can not leverage Server-Side JavaScript or external/reference resources (such as DEs or GET/POST requests).
- The “shortest code” will be determined by character count based on https://charactercounttool.com/, using the “Characters (including spaces)” value.
- Code best practices are not assessed, the aim is to write the shortest functional code.
- In the event of 2 authors submitting solutions with equal (winning) code length, the first/earliest entry will be the winner.
- Attempts to subvert the rules or deviate from the purpose/spirit of this competition will result in disqualification.

**The required output can be found here**: https://github.com/camrobert/SalesforceMarketingCloud/blob/main/Challenge/FizzBuzzBoingBang_Output

The output must be visually identical with a new line for each record as shown below. The method chosen for line breaks is up to you.

Go questions about the challenge or the competition? Post your comments here: https://www.linkedin.com/posts/camrobert_salesforcemarketingcloud-marketingchampions-activity-6843024545507606528-FaK3