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

How to Implement GitHub Copilot in Your Workflow in Under 30 Minutes

How to Implement GitHub Copilot in Your Workflow in Under 30 Minutes If you’re a solo developer or indie hacker, you know that time is your most precious resource. Coding can often

Jun 19, 20263 min read
Ai Coding Tools

Bolt.new vs Cursor: Which AI Tool Delivers Better Code Quality?

Bolt.new vs Cursor: Which AI Tool Delivers Better Code Quality? As indie hackers and solo founders, we often find ourselves scrambling to deliver highquality code under tight deadl

Jun 19, 20263 min read
Ai Coding Tools

How to Train AI Coding Models in Under 2 Hours

How to Train AI Coding Models in Under 2 Hours If you're like me, the idea of training AI coding models can feel daunting. You might think it's reserved for data scientists with Ph

Jun 19, 20264 min read
Ai Coding Tools

How to Build Your First Python App Using AI Coding Tools in 4 Hours

How to Build Your First Python App Using AI Coding Tools in 4 Hours Building your first Python app can feel daunting, especially if you're new to coding or don't have a computer sc

Jun 19, 20265 min read
Ai Coding Tools

How to Increase Your Coding Output by 200% Using AI in 30 Days

How to Increase Your Coding Output by 200% Using AI in 30 Days As a solo founder or indie hacker, you know that coding can often feel like a race against time. The more you can cra

Jun 19, 20265 min read
Ai Coding Tools

Supabase vs Firebase: Which is the Superior Choice for AI Projects in 2026?

Supabase vs Firebase: Which is the Superior Choice for AI Projects in 2026? As we step into 2026, the landscape for building AI projects continues to evolve, and choosing the right

Jun 19, 20264 min read