ChatGPT writes my routine in 12 top programming languages. Here’s what the results tell me

Must Read
bicycledays
bicycledayshttp://trendster.net
Please note: Most, if not all, of the articles published at this website were completed by Chat GPT (chat.openai.com) and/or copied and possibly remixed from other websites or Feedzy or WPeMatico or RSS Aggregrator or WP RSS Aggregrator. No copyright infringement is intended. If there are any copyright issues, please contact: bicycledays@yahoo.com.

Over the previous yr, we have all come to know that ChatGPT can write code. I gave it a variety of exams in PHP and WordPress that confirmed the strengths and weaknesses of ChatGPT’s coding capabilities.

However how far does ChatGPT’s coding information prolong? After I initially drafted this text in early 2023, I threw the traditional “Whats up, world” programming project in opposition to the 12 hottest languages in O’Reilly Media’s recognition rankings for 2023. 

We have subsequently performed plenty of evaluation about programming language recognition, however even with this late 2024 replace, I am sticking with the unique 12 languages we examined. Whereas a few of our 12 aren’t actually massively widespread languages, they’re nonetheless present and in use. This choice offers us an excellent cross-section to higher assist us perceive how properly ChatGPT handles a variety of languages.

As a result of “Whats up, world” can typically be coded in a single line, I added a slight wrinkle, having ChatGPT current “Whats up, world” ten occasions, every time incrementing a counter worth. I additionally requested it to test the time and start every sequence with “Good morning,” “Good afternoon,” or “Good night.”

This provides us a take a look at program move and a few intrinsic features as properly, however nonetheless retains the code sufficiently small that I can embrace a dozen screenshots on this article.

Here is the immediate:

Write a program in ____ that outputs “Good morning,” “Good afternoon,” or “Good night” primarily based on what time it’s right here in Oregon, after which outputs ten strains containing the loop index (starting with 1), an area, after which the phrases “Whats up, world!”.

For every programming language, I additionally requested ChatGPT to explain its main use. Here is the immediate I used for this question:

For every of the next languages, write a one-sentence description of its main use and differentiating issue: Java, Python, Rust, Go, C++, JavaScript, C#, C, TypeScript, R, Kotlin, Scala.

Now, let’s take a look at every language.

1. Java

ChatGPT describes Java as, “A general-purpose language used primarily for constructing desktop, internet, and cell functions, and recognized for its ‘write as soon as, run wherever’ philosophy.”

Java was initially developed by Solar Microsystems, however when Oracle purchased Solar, it additionally purchased Java. Whereas the Java spec is open, the language is owned by Oracle. This has led to some spectacular authorized fireworks over time.

Here is ChatGPT’s code:

2. Python

ChatGPT describes Python as,” A general-purpose language used for information evaluation, synthetic intelligence, internet improvement, and automation, and recognized for its readability and ease of use.”

My recommendation: when you plan to be taught to code for AI functions, be taught Python. Virtually all AI code has tight Python integration.

Here is ChatGPT’s code:

3. Rust

ChatGPT describes Rust as, “A methods programming language used for constructing high-performance and dependable software program, and recognized for its reminiscence security and thread security ensures.”

Here is ChatGPT’s code:

4. Go

ChatGPT describes Go as, “A methods programming language used for constructing scalable and environment friendly community and server functions, and recognized for its simplicity and built-in concurrency options.”

Go is open supply, but it surely’s managed by Google. Go. Google. Get it?

Here is ChatGPT’s code:

5. C++

ChatGPT describes C++ as, “A methods programming language used for constructing working methods, recreation engines, and high-performance functions, and recognized for its management over {hardware} and reminiscence.”

Here is ChatGPT’s code:

6. JavaScript

ChatGPT describes JavaScript as, “A client-side scripting language used for constructing interactive internet functions, and recognized for its widespread use in internet improvement and its means to run in internet browsers.”

Also, together with CSS (one of many internet’s essential visible design languages), JavaScript is liable for 87.45% of the profanity I’ve uttered over the previous 9, or so, years.

Here is ChatGPT’s code:

7. C#

ChatGPT describes C# as, “A general-purpose language used for constructing Home windows desktop functions, video games, and internet functions, and recognized for its object-oriented options and integration with the .NET framework.”

C# is a proprietary language provided by Microsoft. I taught it on the UC Berkeley extension for greater than a decade. It’s a very attention-grabbing gateway language for anybody desirous to get work programming for predominantly Microsoft environments.

Here is ChatGPT’s code:

8. C

ChatGPT describes C as, “A methods programming language used for constructing working methods, embedded methods, and high-performance functions, and recognized for its effectivity and low-level management.”

They are saying you always remember your past love. Earlier than educating myself to program C again within the days of wood ships and iron programmers, I by no means really beloved a programming language. However then I began to make use of C and my world modified. It was love. One thing concerning the concise simplicity of the language simply spoke to me on a deep and primal degree. That is in all probability an overshare, but it surely’s additionally true. C will all the time be my first syntactic love.

Here is ChatGPT’s code:

9. TypeScript

ChatGPT describes TypeScript as, “A superset of JavaScript used for constructing large-scale internet functions, and recognized for its optionally available static typing and superior language options.”

TypeScript can also be a Microsoft product, however in contrast to C#, it is open-source and non-proprietary.

Here is ChatGPT’s code:

10. R

ChatGPT describes R as, “A language used for statistical computing and information evaluation, and recognized for its highly effective information manipulation and visualization capabilities.”

Here is ChatGPT’s code:

11. Kotlin

ChatGPT describes Kotlin as, “A general-purpose language used for constructing Android apps, server-side functions, and internet functions, and recognized for its conciseness and interoperability with Java.”

Kotlin was developed by JetBrains, a small firm that additionally makes PhpStorm, my present favourite improvement atmosphere.

Here is ChatGPT’s code:

12. Scala

ChatGPT describes Scala as, “A language used for constructing scalable and distributed functions, and recognized for its assist for purposeful programming and its integration with the Java Digital Machine.”

Here is ChatGPT’s code:

Also, discover the output for Scala (proven above). I’ve by no means programmed in Scala and do not know very a lot about it. Neither does ChatGPT, as a result of whereas the AI supplied syntax coloring for all the opposite languages, it did not appear to have that info for Scala.

Remaining ideas (and just a little Forth)

As a pc languages geek, I discovered this train tremendous enjoyable. That mentioned, there are some issues to remember. First, I did not take a look at all of the code. Testing this many outputs is exterior the scope of this text. That mentioned, I did learn by way of the generated code and, for many languages, the code regarded good.

After I final ran these exams virtually a yr in the past, ChatGPT bought virtually every part proper (however the above disclaimer). Nevertheless, when requested to render code in Forth (a really funky however enjoyable language), it generated code that regarded like Forth however labeled the window “Perl.” It undoubtedly did not generate Perl.

Nevertheless, this time, it generated Forth (the colons are a useless giveaway) and labeled it appropriately. Like Scala above, ChatGPT did not appear to have the syntax coloring tables for Forth, however in any other case, it appears to be doing nice.

As with all my different visits down the rabbit gap with ChatGPT and coding, I am impressed but additionally cautious. My suggestions stand: use it as a software, however take a look at, take a look at, and take a look at.


You may comply with my day-to-day venture updates on social media. Make sure to comply with me on Twitter at @DavidGewirtz, on Fb at Fb.com/DavidGewirtz, on Instagram at Instagram.com/DavidGewirtz, and on YouTube at YouTube.com/DavidGewirtzTV.

Latest Articles

AI in Art: Everything You Should Know About Its Role and...

There's a well-known quote by Albert Einstein that claims, “Creativity is intelligence having enjoyable.” However what occurs when intelligence...

More Articles Like This