I used ChatGPT to write the same routine in 12 top programming languages. Here's how it did

According to ChatGPT, Kotlin is described as a versatile programming language that is commonly employed for constructing Android applications, server-side applications, and web applications. It is renowned for its concise syntax and seamless compatibility with Java.

ChatGPT describes Kotlin as, "A versatile language used for building Android apps, server-side applications, and web applications, known for its concise syntax and seamless integration with Java."

In addition: What is Auto-GPT? Everything you need to know about the next powerful AI tool.

Kotlin was developed by JetBrains, a small company that also created PhpStorm, which happens to be my current favorite development environment.

Here's the code provided by ChatGPT:



ChatGPT describes Scala as, "A language primarily used for building scalable and distributed applications, known for its strong support for functional programming and seamless integration with the Java Virtual Machine."

Here's the code provided by ChatGPT:

scala (1).jpg

Final thoughts

As a computer languages enthusiast, I thoroughly enjoyed this exercise. However, there are a few things to keep in mind. First, I didn't test all of the code. Testing such a large number of outputs is beyond the scope of this article. Nevertheless, I carefully reviewed the generated code, and for most languages, it looked solid.

Also: AI has the potential to automate 25% of all jobs. Here's a breakdown of which jobs are most (and least) at risk.

However, ChatGPT sometimes loses its focus. Out of curiosity, I asked it to generate the same code in Forth (a rather quirky but fun language). While the generated code was indeed Forth (the colons at the beginning are a dead giveaway), the code block was labeled as "perl" (another amusing and unconventional language). This code is definitely not Perl:


In addition, take note of the output for Scala (as shown above). I have minimal experience with Scala and know very little about it. Apparently, ChatGPT shares my lack of knowledge, because while it provided syntax coloring for all the other languages, it seemed to lack that information for Scala.

After exploring ChatGPT and coding several times, I am always impressed but also cautious. My advice remains the same: use it as a tool, but thoroughly test, test, and test.

Related Articles

View More >>

Unlock the power of AI with HIX.AI!