Ai Coding Tools

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

By BTW Team3 min read

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

Getting started with coding can feel overwhelming. You might be staring at a blank screen, unsure of where to even begin. That’s where GitHub Copilot comes in. As a coding assistant powered by AI, it can help you write your first lines of code, making the learning process more approachable. In this guide, I’ll walk you through how to leverage GitHub Copilot to write your first 10 lines of code, even if you’ve never coded before.

Time Estimate: 30 Minutes

You can finish this tutorial in about 30 minutes if you follow along step-by-step.

Prerequisites

Before diving in, make sure you have:

  • A GitHub account (sign up for free if you don’t have one)
  • Visual Studio Code (VS Code) installed on your machine
  • GitHub Copilot extension installed (comes with a free trial for new users)

Step-by-Step Guide

Step 1: Set Up Visual Studio Code

  1. Open Visual Studio Code.
  2. Go to the Extensions view by clicking on the Extensions icon in the sidebar or pressing Ctrl+Shift+X.
  3. Search for "GitHub Copilot" and install the extension.

Step 2: Open a New File

  1. Click on File > New File or press Ctrl+N.
  2. Save the file with a .js extension (for JavaScript) or .py (for Python) depending on your preference.

Step 3: Write Your First Line of Code

  1. Start typing a comment about what you want to do. For example, if you're coding in JavaScript, type // Function to add two numbers.
  2. GitHub Copilot will automatically suggest a code snippet. If you see a suggestion you like, press Tab to accept it.

Step 4: Write More Lines

Continue by adding more comments and letting Copilot suggest code. Here’s an example sequence:

  • Comment: // Function to subtract two numbers

    • Suggestion: function subtract(a, b) { return a - b; }
  • Comment: // Function to multiply two numbers

    • Suggestion: function multiply(a, b) { return a * b; }

Step 5: Test Your Code

  1. If you’ve written code in JavaScript, you can run it using Node.js. Install it if you don’t have it already.
  2. Open a terminal in VS Code and run your script by typing node filename.js.

Expected Outputs

After you’ve written your first 10 lines of code, you should have a simple calculator with functions for addition, subtraction, multiplication, and division.

Troubleshooting Common Issues

  • Copilot Suggestions Aren't Appearing: Make sure you’re signed into GitHub and that the Copilot extension is enabled.
  • Code Doesn’t Work: Double-check your syntax and ensure you’re using the right programming language.

What’s Next?

Once you’ve successfully written your first lines of code, consider expanding your project. Try adding more functions or even building a simple user interface. You might also explore more advanced coding concepts like loops and conditionals.

Conclusion: Start Here

GitHub Copilot is an excellent tool for beginners looking to write their first lines of code. By leveraging its capabilities, you can accelerate your coding journey and build confidence as you learn.

If you’re ready to dive deeper into coding, consider checking out our podcast, Built This Week, where we discuss tools and techniques for building projects in public.

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