Ai Coding Tools

How to Use GitHub Copilot for Beginners: Write Your First Function in 10 Minutes

By BTW Team3 min read

How to Use GitHub Copilot for Beginners: Write Your First Function in 10 Minutes

If you're a beginner in coding, the thought of writing functions from scratch can feel overwhelming. Enter GitHub Copilot, an AI-powered coding assistant that can help you write code faster and with more confidence. But how do you actually use it? In this guide, we’ll walk you through writing your first function with GitHub Copilot in just 10 minutes.

Prerequisites: What You Need

Before diving in, make sure you have the following:

  1. A GitHub Account: You can sign up for free at GitHub.com.
  2. Visual Studio Code (VS Code): Download and install it if you don’t have it already.
  3. GitHub Copilot Subscription: As of May 2026, GitHub Copilot costs $10/month after a free trial. You can cancel anytime.

Step-by-Step: Writing Your First Function

Step 1: Install GitHub Copilot

  1. Open VS 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 click on "Install".
  4. Follow the prompts to authenticate with your GitHub account.

Step 2: Create a New File

  1. Create a new file in VS Code with a .js extension (for JavaScript) or any other language you prefer.
  2. Start typing a comment to describe the function you want to create. For example:
    // Function to calculate the square of a number
    

Step 3: Let Copilot Suggest Code

  1. After typing the comment, hit Enter.
  2. GitHub Copilot will suggest a code snippet. It might look like this:
    function square(num) {
        return num * num;
    }
    
  3. If you like the suggestion, hit Tab to accept it. If not, you can scroll through other suggestions by pressing Ctrl + ] or Ctrl + [.

Step 4: Test Your Function

  1. Below your function, call it with a test value:
    console.log(square(5)); // Should print 25
    
  2. Save your file and run it using Node.js or your preferred runtime.

Expected Output

If everything goes smoothly, running your file should print 25 in the console, confirming that your function works!

Troubleshooting Common Issues

  • No Suggestions: If Copilot doesn’t suggest anything, ensure your comments are clear and descriptive. Sometimes, more context helps.
  • Incorrect Code: Review the suggested code carefully. AI can make mistakes, so always validate the outputs.

What's Next?

Now that you've successfully written your first function, consider exploring more complex functions or even other languages. GitHub Copilot can assist with:

  • Writing tests for your functions.
  • Creating entire classes or modules.
  • Learning new programming concepts through code suggestions.

Limitations of GitHub Copilot

While GitHub Copilot is incredibly useful, it does have its limitations:

  • Context Awareness: It might not fully understand your project's context, leading to irrelevant suggestions.
  • Learning Curve: Beginners might still need to learn basic coding principles to make the most of Copilot's suggestions.
  • Cost: The $10/month fee might be a barrier for some indie hackers.

Conclusion: Start Here

If you're just starting with coding, GitHub Copilot can significantly reduce the learning curve and speed up your development process. Follow the steps above, and you'll be writing functions in no time. Don't forget to keep experimenting with different types of functions and coding languages!

What We Actually Use

In our experience, we use GitHub Copilot mainly for rapid prototyping and learning new languages. It’s not a replacement for understanding code but a fantastic tool to speed up our workflow.

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