David Gewirtz/ZDNET (with a little help from ChatGPT)Over the past year, we’ve all come to know that ChatGPT can write code. I gave it a number of tests in PHP and WordPress that showed the strengths and weaknesses of ChatGPT’s coding capabilities.Also: Your dream programming job demands this language, every site agreesBut how far does ChatGPT’s coding knowledge extend? When I originally drafted this article in early 2023, I threw the classic “Hello, world” programming assignment against the 12 most popular languages in O’Reilly Media’s popularity rankings for 2023. We’ve subsequently done a lot of analysis about programming language popularity, but even with this late 2024 update, I’m sticking with the original 12 languages we tested. While some of our 12 aren’t really massively popular languages, they’re still current and in use. This selection gives us a very good cross-section to better help us understand how well ChatGPT handles a wide range of languages.Because “Hello, world” can often be coded in one line, I added a slight wrinkle, having ChatGPT present “Hello, world” ten times, each time incrementing a counter value. I also asked it to check the time and begin each sequence with “Good morning,” “Good afternoon,” or “Good evening.”Also: The best AI for coding in 2024 (and what not to use)This gives us a look at program flow and some intrinsic functions as well, but still keeps the code small enough that I can include a dozen screenshots in this article.Here’s the prompt: Write a program in ____ that outputs “Good morning,” “Good afternoon,” or “Good evening” based on what time it is here in Oregon, and then outputs ten lines containing the loop index (beginning with 1), a space, and then the words “Hello, world!”. For each programming language, I also asked ChatGPT to describe its primary use. Here’s the prompt I used for this query: For each of the following languages, write a one-sentence description of its primary use and differentiating factor: Java, Python, Rust, Go, C++, JavaScript, C#, C, TypeScript, R, Kotlin, Scala. Now, let’s look at each language. 1. Java ChatGPT describes Java as, “A general-purpose language used primarily for building desktop, web, and mobile applications, and known for its ‘write once, run anywhere’ philosophy.” Also: Google’s Gems are a gentle introduction to AI prompt engineeringJava was originally developed by Sun Microsystems, but when Oracle bought Sun, it also bought Java. While the Java spec is open, the language is owned by Oracle. This has led to some spectacular legal fireworks over the years. Here’s ChatGPT’s code: More