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

10 AI Coding Tools That Will Drastically Reduce Your Debugging Time

10 AI Coding Tools That Will Drastically Reduce Your Debugging Time As a developer, whether you're just starting out or have years of experience, debugging can feel like a neverend

Oct 16, 20265 min read
Ai Coding Tools

10 Common Mistakes When Integrating AI Coding Tools into Your Workflow

10 Common Mistakes When Integrating AI Coding Tools into Your Workflow As developers, we’re always on the lookout for ways to streamline our workflow and boost productivity. Enter

Oct 14, 20264 min read
Ai Coding Tools

5 Myths About AI Coding Tools That Could Hurt Your Development Process

5 Myths About AI Coding Tools That Could Hurt Your Development Process As a solo founder or indie hacker, you might be lured by the promises of AI coding tools that claim to simpli

Oct 13, 20264 min read
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