Ai Coding Tools

How to Use GitHub Copilot to Write Your First 5 Functions in Under 30 Minutes

By BTW Team4 min read

How to Use GitHub Copilot to Write Your First 5 Functions in Under 30 Minutes

If you're a solo founder or an indie hacker, you probably wear many hats. One of those hats is likely a developer's hat, whether you're a seasoned coder or just starting out. But here's the reality: writing functions can be tedious, especially if you're not fully comfortable with the syntax or logic. Enter GitHub Copilot—an AI-powered coding assistant that can help you write code faster. In this guide, I’ll show you how to use GitHub Copilot to write your first five functions in under 30 minutes. Yes, really.

Prerequisites

Before we dive in, here's what you need:

  • GitHub account: Free to create.
  • Visual Studio Code: Download and install it if you haven't already.
  • GitHub Copilot subscription: $10/month or $100/year, but it offers a free trial for new users.
  • Basic understanding of programming: It helps to know some fundamentals in the language you're using.

Step 1: Set Up GitHub Copilot

  1. Install the GitHub Copilot extension in Visual Studio Code. Go to the Extensions panel, search for "GitHub Copilot," and click install.
  2. Sign in to your GitHub account when prompted. After logging in, you’ll see a welcome message confirming that Copilot is activated.

Step 2: Create a New File and Start Coding

  1. Create a new file: Open a new JavaScript file (or Python, if that's your jam).
  2. Write a comment for the first function: For example, type // Function to add two numbers and press enter. Copilot will suggest a function based on your comment.
  3. Accept the suggestion: If it looks good, just hit the "Tab" key to insert it into your file.

Example Function

// Function to add two numbers
function add(a, b) {
    return a + b;
}

Step 3: Repeat for Four More Functions

Now, repeat the process for four more functions. Here are some examples you can try:

  1. Multiply two numbers

    // Function to multiply two numbers
    function multiply(a, b) {
        return a * b;
    }
    
  2. Find the maximum of two numbers

    // Function to find the maximum of two numbers
    function max(a, b) {
        return a > b ? a : b;
    }
    
  3. Check if a number is even

    // Function to check if a number is even
    function isEven(n) {
        return n % 2 === 0;
    }
    
  4. Reverse a string

    // Function to reverse a string
    function reverseString(str) {
        return str.split('').reverse().join('');
    }
    

Expected Outputs

By the end of this setup, you should have a file with five simple functions that perform basic operations. You can test them directly in your console to see if they work as expected.

Troubleshooting Section

What could go wrong?

  • Copilot doesn't suggest anything: Make sure you're connected to the internet and GitHub Copilot is activated. Sometimes, simply restarting VS Code helps.
  • The suggestions are off: Remember, Copilot is trained on a vast dataset. If it suggests something that doesn't make sense, you can always modify the code manually.

What's Next

Once you've got your five functions down, consider expanding your skills by:

  • Building a small project: Combine these functions into a simple calculator app or a text manipulation tool.
  • Learning more about GitHub Copilot: Explore its features, like how it can help with comments or tests.
  • Joining communities: Engage with other developers who use Copilot for tips and tricks.

Conclusion

Using GitHub Copilot can significantly speed up your coding process, especially for beginners. In under 30 minutes, you can have five functional pieces of code that you can build upon. If you haven't tried GitHub Copilot yet, I recommend starting with the free trial—it’s a low-risk way to see if it fits your workflow.

What We Actually Use

In our experience, we use GitHub Copilot alongside traditional coding resources. While it’s not perfect, it helps us avoid the mundane parts of coding, allowing us to focus on logic and design.

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