Ai Coding Tools

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

By BTW Team3 min read

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

If you’re a solo founder or indie hacker looking to speed up your coding process, GitHub Copilot can feel like a magic wand. But let’s be real: it can also be overwhelming for beginners. You might be thinking, “Can this AI really help me write functions quickly?” Spoiler alert: Yes, it can, and I’m going to show you how to write your first five functions in under 30 minutes.

Prerequisites: What You Need to Get Started

Before diving in, here’s what you’ll need:

  • GitHub Account: Free to create if you don't have one.
  • Visual Studio Code (VS Code): Download and install it.
  • GitHub Copilot Subscription: $10/month or $100/year after a free trial.
  • Basic Understanding of JavaScript or Python: Familiarity will help, but don’t worry if you’re just starting out.

Step 1: Setting Up GitHub Copilot

  1. Install VS Code: Go to the VS Code website and download the latest version.
  2. Install Copilot: Open VS Code, go to Extensions (Ctrl+Shift+X), and search for "GitHub Copilot." Click "Install."
  3. Sign In: Once installed, click on the Copilot icon in the sidebar and sign in with your GitHub account. You’ll need to activate your subscription if you haven't already.

Expected Output: You should see a Copilot icon in the bottom-right corner of your VS Code window, indicating it's ready to assist.

Step 2: Writing Your First Function

Function 1: Simple Addition

  1. Open a new file (e.g., functions.js).
  2. Type function add(a, b) { and hit Enter.
  3. Copilot will suggest the function body. Accept the suggestion.

Expected Output: A function that adds two numbers and returns the result.

Function 2: String Reversal

  1. Below the previous function, type function reverseString(str) { and hit Enter.
  2. Accept Copilot’s suggestion for reversing the string.

Expected Output: A function that takes a string and returns it reversed.

Function 3: Factorial Calculation

  1. Add function factorial(n) { and hit Enter.
  2. Let Copilot generate the logic for calculating the factorial.

Expected Output: A function that computes the factorial of a number.

Function 4: Checking for Prime Numbers

  1. Type function isPrime(num) { and hit Enter.
  2. Accept the suggested code that checks if the number is prime.

Expected Output: A function that returns true if the number is prime, false otherwise.

Function 5: FizzBuzz

  1. Finally, type function fizzBuzz(n) { and hit Enter.
  2. Let Copilot fill in the logic for the classic FizzBuzz problem.

Expected Output: A function that prints "Fizz", "Buzz", or "FizzBuzz" for numbers from 1 to n.

Troubleshooting: What Could Go Wrong

  1. Copilot Doesn’t Suggest Code: Make sure you’re online and logged in. Sometimes, simply restarting VS Code can help.
  2. Incorrect Suggestions: If Copilot suggests something that doesn’t make sense, you can type a comment describing what you want, and it will adjust its suggestions accordingly.
  3. Function Errors: Test each function after writing it to ensure it behaves as expected. If it doesn’t, debug the code as you would normally.

What’s Next: Building on Your Functions

After you’ve written these functions, consider integrating them into a simple project. For instance, you could create a basic calculator or a small game that utilizes your functions. This will reinforce your learning and give you practical experience.

Conclusion: Start Here

If you're looking to enhance your coding speed and efficiency, GitHub Copilot is a fantastic tool. Follow the steps outlined above, and you’ll have your first five functions written in no time. Remember, while Copilot can give you a head start, always review and understand the code it generates.

In our experience, GitHub Copilot is worth the investment for anyone serious about coding efficiently, especially if you’re working on side projects or building products.

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

Why GitHub Copilot Might Not Be the Best Choice for Pros

Why GitHub Copilot Might Not Be the Best Choice for Pros (2026) As a seasoned developer, you may have heard the hype around GitHub Copilot. It’s designed to help you code faster by

Mar 19, 20264 min read
Ai Coding Tools

How to Implement AI Coding Tools to Boost Your Workflow in 2 Hours

How to Implement AI Coding Tools to Boost Your Workflow in 2026 Are you a solo founder or indie hacker struggling to keep up with coding demands? If you're like many builders, you

Mar 19, 20264 min read
Ai Coding Tools

Bolt.new vs Lovable: Which AI App Builder Delivers Faster Results?

Bolt.new vs Lovable: Which AI App Builder Delivers Faster Results? As indie hackers and solo founders, we’re always on the lookout for tools that help us ship faster. Time is money

Mar 19, 20263 min read
Ai Coding Tools

AI Code Assistants: Cursor vs GitHub Copilot - Which is Best for Experts?

AI Code Assistants: Cursor vs GitHub Copilot Which is Best for Experts? (2026) As expert developers, we often find ourselves caught in the whirlwind of choosing the right tools to

Mar 19, 20263 min read
Ai Coding Tools

How to Use Cursor AI to Boost Your Coding Speed in 1 Hour

How to Use Cursor AI to Boost Your Coding Speed in 1 Hour As a solo founder or indie hacker, you know the importance of efficiency in coding. You might find yourself stuck on munda

Mar 19, 20263 min read
Ai Coding Tools

How to Integrate AI Coding Tools into Your Workflow in One Week

How to Integrate AI Coding Tools into Your Workflow in One Week Integrating AI coding tools into your workflow might sound like a daunting task, especially if you're a solo founder

Mar 19, 20265 min read