Writing

FizzBuzz in the RedMonk Top 20

Originally published on Medium.

A colourful illustration of FizzBuzz numbers surrounded by programming language logos and cartoon robots.

Programming languages vary widely in syntax, paradigms, and use cases. My own preferred language of choice is SWIFT (obvs!) since I develop Apps for the Apple Ecosystem. That doesn’t mean I’m not interested in the outside world from my comfortable Apple garden. A recent X post demonstrated “Hello World” Screen output in a range of different languages and it got me thinking, what are the most popular languages and how many are there?

Turns out there are a LOT of languages you can code in. Many of them completely obscure. A comprehensive list of languages can be found here: https://programminglanguages.info/languages/. This counts over 1630 languages at a quick glance. Dig a little deeper and you’ll discover the `Online Historical Encyclopaedia of Programming Languages` which has an agregate collection of over 9000 languages. Wikipedia has it’s own lists here: https://en.wikipedia.org/wiki/Lists_of_programming_languages. The reality is anyone can copy an existing language, make some modifications to it and republish it with a new open licence, a new sprangled name and publish it as the latest fad in computing languages; presumably solving some obscure problem nobody has heard about!

So the question then becomes which languages should we focus on to create a demonstration of the differences between languages? Well thanks to my AI Partner and Researcher, there are a number of good lists:

  • GitHub’s annual State of the Octoverse reports and their Linguist tool (which detects languages in repositories) track about 600–700 languages with detectable activity in public repos as of 2024–2025 data.
  • TIOBE Index and PYPL Share of Searches.
  • Stack Overflow and Developer Surveys: The 2025 Stack Overflow survey (with 49,000+ respondents) covered usage of about 50–100 languages in detail, but their tags database tracks discussions on over 700 languages with at least some activity (e.g., including legacy ones like Fortran or emerging ones like Zig)
  • IEEE Spectrum and RedMonk Cross-References: These rank top 50–100 but reference broader datasets (e.g., from Rosetta Code, which has sample code in 800+ languages, with ~700 showing recent edits).

In practice, only about 50–100 languages dominate 99% of real-world usage.

But this is still far too many lanaguages to demonstrate differences in writing code. A good balance would be about 10–20 languages we can reference. Thankfully, RedMonk have done that for us:

RedMonk Top 20 Languages Over Time: January 2025

So let’s now highlight these differences with the classic FizzBuzz challenge across the top 20 languages from the RedMonk Rankings (January 2025). FizzBuzz is a simple maths game used to help teach children division. It’s also a nice simple algorithm to demonstate Loops and division in a range:

Our FizzBuzz challenge will be to loop from 1 to 100 and print:

  • “FizzBuzz” if divisible by 15,
  • “Fizz” if divisible by 3,
  • “Buzz” if divisible by 5,
  • Otherwise, the number.

This exercise reveals differences in loops, conditionals, modulo operators, and output methods. We’ll use minimal, executable snippets (some require full program structure or imports).

Now admittedly I have absolutely no idea how to do this in these languages so I’ve asked Grok to do it for me. If you spot errors and hallucinations please let me know. I’ve checked what I can. It’s interesting to see the differences!

Enjoy fellow coders!

Till the Next Byte,

British Dev Diary

1. JavaScript

JavaScript uses loose typing and console.log for output. Note the strict equality ===.

for (let i = 1; i <= 100; i++) {
  if (i % 15 === 0) console.log("FizzBuzz");
  else if (i % 3 === 0) console.log("Fizz");
  else if (i % 5 === 0) console.log("Buzz");
  else console.log(i);
}

2. Python

Python’s readability shines with indentation-based blocks and range.

for i in range(1, 101):
    if i % 15 == 0:
        print("FizzBuzz")
    elif i % 3 == 0:
        print("Fizz")
    elif i % 5 == 0:
        print("Buzz")
    else:
        print(i)

3. Java

Java requires a class and main method, with verbose System.out.

public class FizzBuzz {
    public static void main(String[] args) {
        for (int i = 1; i <= 100; i++) {
            if (i % 15 == 0) System.out.println("FizzBuzz");
            else if (i % 3 == 0) System.out.println("Fizz");
            else if (i % 5 == 0) System.out.println("Buzz");
            else System.out.println(i);
        }
    }
}

4. PHP

PHP mixes scripting with echoes and uses elseif.

<?php
for ($i = 1; $i <= 100; $i++) {
    if ($i % 15 == 0) echo "FizzBuzz\n";
    elseif ($i % 3 == 0) echo "Fizz\n";
    elseif ($i % 5 == 0) echo "Buzz\n";
    else echo $i . "\n";
}
?>

5. C#

C# is similar to Java, using Console.WriteLine from System.

using System;
class Program {
    static void Main() {
        for (int i = 1; i <= 100; i++) {
            if (i % 15 == 0) Console.WriteLine("FizzBuzz");
            else if (i % 3 == 0) Console.WriteLine("Fizz");
            else if (i % 5 == 0) Console.WriteLine("Buzz");
            else Console.WriteLine(i);
        }
    }
}

6. TypeScript

TypeScript compiles to JavaScript, sharing identical runtime syntax here.

for (let i = 1; i <= 100; i++) {
  if (i % 15 === 0) console.log("FizzBuzz");
  else if (i % 3 === 0) console.log("Fizz");
  else if (i % 5 === 0) console.log("Buzz");
  else console.log(i);
}

7. CSS

CSS isn’t for algorithms; it’s for styling. Can’t implement logic natively.

/* Not real FizzBuzz - just static text */
body::after {
  content: "Hello from CSS (no logic here)";
}

7 (Tie). C++

C++ uses streams like cout and requires headers.

#include <iostream>
using namespace std;
int main() {
    for (int i = 1; i <= 100; i++) {
        if (i % 15 == 0) cout << "FizzBuzz" << endl;
        else if (i % 3 == 0) cout << "Fizz" << endl;
        else if (i % 5 == 0) cout << "Buzz" << endl;
        else cout << i << endl;
    }
    return 0;
}

9. Ruby

Ruby’s blocks and each make it concise.

(1..100).each do |i|
  if i % 15 == 0
    puts "FizzBuzz"
  elsif i % 3 == 0
    puts "Fizz"
  elsif i % 5 == 0
    puts "Buzz"
  else
    puts i
  end
end

10. C

Low-level C uses printf and stdio.

#include <stdio.h>
int main() {
    for (int i = 1; i <= 100; i++) {
        if (i % 15 == 0) printf("FizzBuzz\n");
        else if (i % 3 == 0) printf("Fizz\n");
        else if (i % 5 == 0) printf("Buzz\n");
        else printf("%d\n", i);
    }
    return 0;
}

11. Swift

Swift uses ranges and simple print.

for i in 1...100 {
    if i % 15 == 0 {
        print("FizzBuzz")
    } else if i % 3 == 0 {
        print("Fizz")
    } else if i % 5 == 0 {
        print("Buzz")
    } else {
        print(i)
    }
}

12. Go

Go requires packages and formatted prints.

package main
import "fmt"
func main() {
    for i := 1; i <= 100; i++ {
        if i%15 == 0 {
            fmt.Println("FizzBuzz")
        } else if i%3 == 0 {
            fmt.Println("Fizz")
        } else if i%5 == 0 {
            fmt.Println("Buzz")
        } else {
            fmt.Println(i)
        }
    }
}

12 (Tie). R

R uses %% for modulo and cat for output.

for (i in 1:100) {
  if (i %% 15 == 0) {
    cat("FizzBuzz\n")
  } else if (i %% 3 == 0) {
    cat("Fizz\n")
  } else if (i %% 5 == 0) {
    cat("Buzz\n")
  } else {
    cat(i, "\n")
  }
}

14. Shell (Bash)

Shell scripting with arithmetic expansion.

for i in {1..100}; do
  if [ $((i % 15)) -eq 0 ]; then
    echo "FizzBuzz"
  elif [ $((i % 3)) -eq 0 ]; then
    echo "Fizz"
  elif [ $((i % 5)) -eq 0 ]; then
    echo "Buzz"
  else
    echo $i
  fi
done

14 (Tie). Kotlin

Kotlin’s when expression is expressive.

fun main() {
    for (i in 1..100) {
        when {
            i % 15 == 0 -> println("FizzBuzz")
            i % 3 == 0 -> println("Fizz")
            i % 5 == 0 -> println("Buzz")
            else -> println(i)
        }
    }
}

14 (Tie). Scala

Scala blends OOP and functional styles.

object FizzBuzz extends App {
  for (i <- 1 to 100) {
    if (i % 15 == 0) println("FizzBuzz")
    else if (i % 3 == 0) println("Fizz")
    else if (i % 5 == 0) println("Buzz")
    else println(i)
  }
}

17. Objective-C

Objective-C uses Foundation and NSLog.

#import <Foundation/Foundation.h>
int main(int argc, const char * argv[]) {
    @autoreleasepool {
        for (int i = 1; i <= 100; i++) {
            if (i % 15 == 0) NSLog(@"FizzBuzz");
            else if (i % 3 == 0) NSLog(@"Fizz");
            else if (i % 5 == 0) NSLog(@"Buzz");
            else NSLog(@"%d", i);
        }
    }
    return 0;
}

18. PowerShell

PowerShell uses cmdlets like Write-Output.

for ($i = 1; $i -le 100; $i++) {
  if ($i % 15 -eq 0) { Write-Output "FizzBuzz" }
  elseif ($i % 3 -eq 0) { Write-Output "Fizz" }
  elseif ($i % 5 -eq 0) { Write-Output "Buzz" }
  else { Write-Output $i }
}

19. Rust

Rust emphasizes safety with println! macro.

fn main() {
    for i in 1..=100 {
        if i % 15 == 0 {
            println!("FizzBuzz");
        } else if i % 3 == 0 {
            println!("Fizz");
        } else if i % 5 == 0 {
            println!("Buzz");
        } else {
            println!("{}", i);
        }
    }
}

20. Dart

Dart uses print and is similar to JavaScript.

void main() {
  for (int i = 1; i <= 100; i++) {
    if (i % 15 == 0) {
      print("FizzBuzz");
    } else if (i % 3 == 0) {
      print("Fizz");
    } else if (i % 5 == 0) {
      print("Buzz");
    } else {
      print(i);
    }
  }
}

Key Takeaways

  • Verbosity: Python/Ruby are concise; Java/C++ require boilerplate.
  • Conditionals: If-else chains vs. Kotlin’s when or pattern matching.
  • Output: Varied, from print to echo to streams.
  • Paradigms: Scripting (Shell/PowerShell) vs. compiled (Rust/Go).

This demo underscores why language choice matters for productivity and maintenance. Try running these in your favorite IDE! For more, check RedMonk or TIOBE rankings.

(Inspired by cross-language comparisons like Hello World demos. Data as of 2025.)

All writing