Ai Coding Tools

How to Write Your First Lines of Code Using GitHub Copilot in 2 Hours

By BTW Team3 min read

How to Write Your First Lines of Code Using GitHub Copilot in 2026

As someone who has navigated the often confusing waters of coding, I know how daunting it can be to write your first lines of code. You might feel overwhelmed by the syntax, the tools, and the sheer amount of information out there. But what if I told you that you could harness the power of AI to help you get started? Enter GitHub Copilot, a tool that can assist you in writing code, making the learning curve a bit less steep. In this guide, I’ll walk you through how to write your first lines of code using GitHub Copilot in just 2 hours.

Prerequisites: What You Need Before Starting

Before diving in, here are a few things you’ll need:

  • GitHub Account: Sign up for free at GitHub.
  • Visual Studio Code (VS Code): Download and install it from Visual Studio Code.
  • GitHub Copilot Subscription: As of May 2026, Copilot is priced at $10/month after a 60-day free trial.
  • Basic Understanding of Programming Concepts: Familiarity with coding concepts like variables and functions will help, but it’s not mandatory.

Step 1: Setting Up Your Environment (30 minutes)

  1. Install Visual Studio Code: Once installed, open it and go to Extensions (or press Ctrl + Shift + X).
  2. Search for GitHub Copilot: Install the GitHub Copilot extension.
  3. Sign in to GitHub: Follow the prompts to authenticate your GitHub account with VS Code.
  4. Create a New File: Start a new file and save it with a .js extension if you want to code in JavaScript.

Expected Output: You should see the GitHub Copilot icon in your VS Code sidebar.

Step 2: Writing Your First Lines of Code (30 minutes)

  1. Start Simple: Type a comment like // Function to add two numbers and hit enter.
  2. Let Copilot Suggest Code: Copilot will suggest a function based on your comment. Accept the suggestion by pressing Tab.
  3. Test Your Code: Type add(2, 3); and run the code in the integrated terminal.

Expected Output: You should see 5 printed in the terminal.

Step 3: Experiment with Different Functions (30 minutes)

  1. Change the Functionality: Modify your comment to // Function to multiply two numbers.
  2. Accept the New Suggestion: Again, let Copilot do the heavy lifting and accept the suggested code.
  3. Run Your New Function: Test it out just like you did before.

Expected Output: You should see the product of the numbers you input.

Troubleshooting: What Could Go Wrong

  • No Suggestions from Copilot: Make sure you are signed in to your GitHub account and that the extension is enabled.
  • Errors in Code: If Copilot suggests code that doesn’t work, don’t hesitate to modify it or write your own. It’s part of the learning process.

What’s Next: Leveling Up Your Skills

After you’ve written your first lines of code, consider the following steps:

  1. Explore More Complex Functions: Try implementing loops, conditionals, or even object-oriented programming.
  2. Join Coding Communities: Platforms like Stack Overflow or Dev.to can provide invaluable support.
  3. Build a Small Project: Start a simple project like a to-do list app to solidify your skills.

Conclusion: Start Here

If you're looking to write your first lines of code, GitHub Copilot is a solid choice to help you along the way. It reduces the intimidation factor of coding and allows you to focus on learning the concepts. In just 2 hours, you can get comfortable enough to start experimenting with your own code.

Remember, coding is a journey, and every line you write takes you one step closer to being proficient.

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

Why You Shouldn't Rely Solely on AI Coding Tools: Myths Debunked

Why You Shouldn't Rely Solely on AI Coding Tools: Myths Debunked As a solo founder or indie hacker, the allure of AI coding tools can be hard to resist. They promise to speed up de

May 12, 20263 min read
Ai Coding Tools

Cursor vs GitHub Copilot: Which AI Tool is Best for Experts? 2026

Cursor vs GitHub Copilot: Which AI Tool is Best for Experts? 2026 As an expert developer, you might find yourself juggling multiple coding challenges, and the right AI tool can mak

May 11, 20263 min read
Ai Coding Tools

How to Write Your First App with AI Coders in 3 Hours

How to Write Your First App with AI Coders in 3 Hours If you're a beginner looking to create your first app, you might feel overwhelmed by the technical skills required. But what i

May 11, 20264 min read
Ai Coding Tools

How to Integrate GitHub Copilot in Your Workflow for Faster Coding in 2026

How to Integrate GitHub Copilot in Your Workflow for Faster Coding in 2026 If you’re a developer, you’ve probably heard the buzz around GitHub Copilot. But let’s be real: does it a

May 11, 20264 min read
Ai Coding Tools

How to Automate Your Coding Workflow with Cursor in 30 Minutes

How to Automate Your Coding Workflow with Cursor in 30 Minutes If you’re like me, the coding workflow can often feel like a tangled mess of repetitive tasks and context switching.

May 11, 20264 min read
Ai Coding Tools

The 10 Biggest Mistakes When Choosing AI Coding Tools

The 10 Biggest Mistakes When Choosing AI Coding Tools (2026) As a solo founder or indie hacker, diving into the world of AI coding tools can feel overwhelming. You want to harness

May 11, 20265 min read