Ai Coding Tools

How to Use GitHub Copilot to Write Your First Five Lines of Code

By BTW Team4 min read

How to Use GitHub Copilot to Write Your First Five Lines of Code

If you're a beginner coder, the thought of writing your first lines of code can be daunting. You might feel overwhelmed by the syntax, the logic, and where to even start. Enter GitHub Copilot, an AI-powered code completion tool that can help you write code faster and with more confidence. In this guide, I'm going to walk you through using GitHub Copilot to write your first five lines of code in 2026.

Time Estimate and Prerequisites

You can finish this in about 30 minutes. Before you start, make sure you have:

  • A GitHub account (free)
  • Visual Studio Code (VS Code) installed on your machine
  • GitHub Copilot extension installed in VS Code (you'll need a subscription)

Step-by-Step Guide to Writing Your First Lines of Code

1. Setting Up GitHub Copilot in VS Code

First, you need to get your environment ready.

  • Install VS Code: If you haven't already, download and install Visual Studio Code from here.
  • Install GitHub Copilot: Go to the Extensions view in VS Code (you can press Ctrl + Shift + X), search for "GitHub Copilot," and click "Install".

2. Creating a New Project

  • Open VS Code.
  • Create a new folder for your project and open it in VS Code.
  • Inside the folder, create a new file called hello.js (or any programming language file you prefer).

3. Writing Your First Line of Code

In the hello.js file, start by typing a comment to describe what you want to do:

// This program prints "Hello, World!" to the console

As you type, GitHub Copilot will suggest completions. You’ll see a greyed-out suggestion appear. To accept it, just hit Tab.

4. Adding More Code

Now, let’s write the code to print "Hello, World!" to the console. You can start typing:

console.log("Hello, World!");

Again, watch for GitHub Copilot's suggestions. If it suggests the line for you, hit Tab to accept.

5. Running Your Code

To run your code, you need to open a terminal in VS Code:

  • Go to the top menu and click on Terminal > New Terminal.
  • In the terminal, type node hello.js and hit Enter. You should see "Hello, World!" printed in the terminal.

6. Expanding Your Code

Now that you’ve written your first line of code, let's add more functionality. You might want to add a simple function. Start typing:

// A function to greet a user
function greet(name) {

GitHub Copilot will likely suggest completing the function. Finish it by accepting the suggestion or typing it yourself.

    console.log("Hello, " + name + "!");
}

7. Calling Your Function

Finally, call your function to see it in action:

greet("Alice");

Repeat the process of running the file in the terminal. Now you should see both greetings in your terminal output.

Troubleshooting Common Issues

  • Copilot Suggestions Not Appearing: Make sure you are signed in to GitHub and that the Copilot extension is enabled.
  • Errors When Running Code: Check your syntax carefully. JavaScript is sensitive to punctuation and spacing.

What's Next?

Now that you’ve successfully written and run your first lines of code, consider exploring more complex features of GitHub Copilot, like generating functions or working with APIs. You can also check out our podcast, Built This Week, where we discuss practical tips for indie hackers and solo founders.

Conclusion

GitHub Copilot can be a fantastic tool for beginners, providing real-time code suggestions and helping you learn as you go. Start with small projects, and over time, you'll find yourself more comfortable writing code.

What We Actually Use

In our experience, we rely on GitHub Copilot for rapid prototyping and learning new programming languages. It's not perfect, but it cuts down the friction of starting from scratch.

Follow Our Building Journey

Weekly podcast episodes on tools we're testing, products we're shipping, and lessons from building in public.

Subscribe

Never miss an episode

Subscribe to Built This Week for weekly insights on AI tools, product building, and startup lessons from Ryz Labs.

Subscribe
Ai Coding Tools

5 Common Mistakes Developers Make When Using AI Coding Tools in 2026

5 Common Mistakes Developers Make When Using AI Coding Tools in 2026 As AI coding tools have become an integral part of a developer's toolkit in 2026, many are still stumbling over

Oct 12, 20264 min read
Ai Coding Tools

5 Myths About AI Coding Tools: What Every Developer Should Know in 2026

5 Myths About AI Coding Tools: What Every Developer Should Know in 2026 As we dive into 2026, the landscape of AI coding tools has evolved significantly, yet many developers still

Oct 11, 20263 min read
Ai Coding Tools

Why AI Coding Assistants Are Overrated for Beginners in 2026

Why AI Coding Assistants Are Overrated for Beginners in 2026 As a solo founder or indie hacker, it’s tempting to think that AI coding assistants are the silver bullet to jumpstart

Oct 10, 20263 min read
Ai Coding Tools

10 Common Mistakes When Using AI Coding Tools for Beginners

10 Common Mistakes When Using AI Coding Tools for Beginners As a beginner in coding, diving into AI coding tools can feel like a doubleedged sword. On one hand, these tools promise

Oct 8, 20264 min read
Ai Coding Tools

5 Common Misconceptions About AI Coding Tools and Why They Hold You Back

5 Common Misconceptions About AI Coding Tools and Why They Hold You Back As a solo founder or indie hacker, you might be considering leveraging AI coding tools to boost your produc

Oct 7, 20264 min read
Ai Coding Tools

5 Common Misconceptions About AI Coding Tools That Will Hurt Your Learning

5 Common Misconceptions About AI Coding Tools That Will Hurt Your Learning As a beginner in coding, diving into the world of AI coding tools can feel like stepping into a futuristi

Oct 6, 20263 min read