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

How to Write Your First Program with AI Tools in Under 1 Hour

How to Write Your First Program with AI Tools in Under 1 Hour Ever felt overwhelmed by the idea of writing your first program? You’re not alone. Many aspiring developers think codi

May 9, 20264 min read
Ai Coding Tools

7 Game-Changing AI Coding Tools for Senior Developers 2026

7 GameChanging AI Coding Tools for Senior Developers 2026 As senior developers, we often find ourselves buried under layers of complexity—code reviews, debugging, and the constant

May 9, 20264 min read
Ai Coding Tools

Cursor vs GitHub Copilot: Which AI Tool Will Save You More Time?

Cursor vs GitHub Copilot: Which AI Tool Will Save You More Time? As indie hackers and solo founders, we’re all looking for ways to maximize productivity without breaking the bank.

May 9, 20263 min read
Ai Coding Tools

How to Build a Simple Web App Using AI Tools in Just 4 Hours

How to Build a Simple Web App Using AI Tools in Just 4 Hours Building a web app can feel like an insurmountable task, especially for indie hackers and solo founders juggling multip

May 9, 20264 min read
Ai Coding Tools

Hover vs Codeium: Which AI Coding Tool is Right for You in 2026?

Hover vs Codeium: Which AI Coding Tool is Right for You in 2026? As a developer in 2026, you're probably feeling the pressure to keep up with the rapid advancements in AI coding to

May 9, 20263 min read
Ai Coding Tools

How to Use GitHub Copilot to Increase Your Coding Speed by 50% in Just 1 Week

How to Use GitHub Copilot to Increase Your Coding Speed by 50% in Just 1 Week As a solo founder or indie hacker, every minute counts. You’re juggling multiple projects, and the las

May 9, 20264 min read