Writing Code Snippet Using AI — OpenAI ChatGPT

How to write a code snippet using AI (OpenAI ChatGPT)

Sung Kim
Geek Culture

--

Even with GitHub Copilot, it takes an effort to write a working code to call a REST API to request information and process the response since you will need to understand the API and its methods. What if you can ask an AI to just write the code for you using simple English? That would be the ultimate time saver.

Photo by Towfiqu barbhuiya on Unsplash

So, I recently (November 30, 2022) came across a news article where OpenAI (OpenAI in partnership with Microsoft co-developed GithHub Copilot) released ‘ChatGPT’ AI system (https://openai.com/blog/chatgpt/), which interacts with you in a conversational way and people started posting about how ChatGPT can also write code for you. So, I decided to try it out.

This article is divided into three sections:

  • Request ChatGPT to write a code snippet using the Rust programming language.
  • Request ChatGPT to convert the code to an async function.
  • Request ChatGPT to provide a detailed explanation of the code.

Request ChatGPT to write a code snippet using the Rust programming language

--

--

Sung Kim
Geek Culture

A business analyst at heart who dabbles in ai engineering, machine learning, data science, and data engineering. threads: @sung.kim.mw