12 of 18 some cleanup so I can change it into a code-golf

Broken FizzBuzz - Greg Is Confused

(FizzBuzz suggested by quartata in chat)

(Related: Deletion of a blank line in source code which causes unexpected functionality, What? No error?, and Write a line in program that looks useless)

Meet Greg. Greg is the new debugger at your company, and he deals with checking programs to see if they work. If they don't, he tries to find out why and fix them.

Greg is rather new to programming and understands the basics, but still gets tripped up by some advanced things. Sometimes, programs don't work and he doesn't know why.

You don't really like Greg, so you decide to play a game. You create two nearly-identical FizzBuzz-style programs - one which works, and one which doesn't.

For example:

n = input()
if (n % 3 == 0) {
 print "Fizz"
if (n % 5 == 0) {
 print "Buzz"

works, but

n = input()
if (n % 3 = 0) {
 print "Fizz"
if (n % 5 == 0) {
 print "Buzz"

doesn't. Greg is confused (but not by something as simple as this).


  • Your correct program must accept an integer as input and return output as specified below, and your incorrect program must do something else (such as throwing an error or giving invalid output).
  • The valid program's output must print "Fizz" if the number is divisible by 3, "Buzz" if it divisible by 5, "FizzBuzz" if it divisible by both 3 and 5, and nothing if it isn't divisible by 3 or 5.
  • The invalid program's output may do anything else.
  • Greg knows all programming languages to date, including super-obscure ones. Therefore, your answer may be in any language you choose (providing it was created before this challenge was posted.)
  • You MUST have the two programs be nearly identical, except for one small change. The more concealed or insignificant-looking, the better.
  • Greg uses PPCG and has participated in underhanded challenges before, so he knows about the C trigraph (??/). You can't trick him with it.
  • Greg has also seen replacing ASCII characters with nearly-identical Unicode or abusing fonts, meaning that won't work either. Therefore, your program's change must work with all fonts, any may not exploit visual similarity between characters with different code-points.
  • Changing an a to an A is allowed, as long as it's not obvious that that's what broke the program. However, changing a to <unicode character that looks exactly the same> is forbidden.
  • Both programs must be written in the same language with the same version.
  • Your answer must include:
    • The language both programs are written in
    • Two programs: one FizzBuzz program, and another that is broken
    • How to run both of them (the commands must be identical with identical arguments)
    • Why one doesn't work (in spoilertext)
    • The output of the broken one
  • Your programs must have a Levenshtein distance of no more than 10 from one-another. (Meaning that you may add, delete, or change up to 10 characters in the broken code from the correct one.)

Meta Questions

  • Should I remove the requirement to include the output of the broken program?
  • Is 10 too small a maximum Levenshtein distance? I was also considering 15.
  • I had an idea to turn this into a . The winner is the one with the smallest byte count of both combined programs and at least 50 votes. However, I am not sure how this would turn out. What do you guys think?
  • Are any of my rules already forbidden by the standard loopholes? I'd like to remove them if possible to make the post shorter.