It seems like new AI coding technologies
are being released every other week. If you're new to AI or coding in general,
it can be hard to figure out where to start and familiarize yourself
with AI pair programmers. If you can relate to this, Replit’s
Ghostwriter, it's a great choice for you. A Replit it's a free browser-based IDE with an AI coding assistant
called Ghostwriter. Unlike other AI tools like GitHub Copilot, Ghost Writer is a tool
that can be used anywhere at any time as long as you're
connected to the Internet. This tool is perfect for
beginners or any other developers out there
who want the convenience and extensive features
that Replit provides. In this video, I'll guide you how to
use Ghostwriter to help you code. To access Ghostwriter,
first visit replit.com and create or log in into
an existing Replit account. You can sign up through
Google, GitHub or email. Once you've signed in, click on "Cycles". To use Ghostwriter, you will
need a Ghostwriter subscription. The subscription costs 1000 cycles a month,
which is equivalent to 10 dollars a month. Other way is to purchase Replit's
Pro account for 20 dollars a month, which includes access to Ghostwriter
and many other premium features. To start coding, we first
need to make a “Repl”. REPL stands for
read-eval-print and loop and it's a basically Replit's
way of saying your code editor. Let's begin by clicking +
Create Repl in the top left. We can search up and pick the template or
the programming language we want to use. I'm using Python, so
I'm going to click on it. Another way is just to import
code from GitHub and just paste the link into the box or import
directly from the computer. Next, we need to name our Repl. I'll call it practice. I'm going to click on + Create a
Repl to be redirected to a new Repl. On the left half of the page, it's going
to be where you can write your code. On the right is going to
be our console and shell. Ghostwriter has
four main features to complete, generate,
explain and transform code. Let's begin with how we can
use Ghostwriter to complete code. Much like GitHub Copilot
and any other AI tools, Ghostwriter supports
code and autocompletion. Say I want to define a
function for merge sort. I can write a comment with a brief function
description and start coding what I know. While I'm typing,
Ghostwriter already gives me suggestions for
what code should come next, shown by the grayed out text. To accept a suggestion, press "tab". To ignore the suggestion, just
skip typing or press the "Escape" key. Ghostwriter autocompletion
gives suggestions for comments, partially written code
and fully written code. It can help us out in
so many different ways. For example, we can use Ghostwriter
to create effective test cases. This is a huge help for
those of us who struggle with finding throughout
tests to evaluate our code. Here, Ghostwriter even
suggests a comment for what the expected result of
each text case should be. If we run out of
functions and test cases, we can see that our merge
function does indeed work. Ghostwriter also can give us relevant
functions after we complete the code. For example, if you
complete a min() function, Ghostwriter will suggest
a max() function after, and min() function after that. With Ghostwriter's
continuous code suggestions, the days of being "stuck
on code" are long gone. Now, what if you want to code something,
but you have no idea where to start? Ghostwriter can generate
entire code from scratch with no previous comments
or code necessary. I have this empty
editor here and I want to make a function that
draws 5 overlap circles. Just click on the Repl and click
generate code on the drop down. An input box will pop
up and there you can type whatever you want
Ghostwriter to create. Then click generate and Ghostwriter's
code will be output in the code created. You can either manually
copy and paste the code into your editor or just
click insert the code. “insert in editor”. If we run this function, we
can see that it works correctly. With this feature, you can learn so
much about different coding algorithms, approaches, libraries and
more from the code generated. Ghostwriter's third main feature
is the ability to explain code. I'm having this code
here, but I'm having trouble understanding what it
does and how it works. All I have to do is select the
code I want an explanation for. Right click on the selected
text and click on "explain code". If I'm confused about all the
code, I'm going to select all of it. Ghostwriter will give you an
explanation in the same pop-up, making it simple to read
and easy to understand. Notice that since I selected
the entire code, Ghostwriter explains the
function and its steps as a whole. If I was only confused about
what happens on the specific line, I will just select the
line for my explanation. As you can see, Ghostwriter gives
a much more specific explanation that does not take into
account the lines I did not select. With this feature, it is easier
to debug your code and learn about how different code
functions and algorithms work. Ghostwriter can also transform
code, which is as cool as it sounds. If you find that your code is not
working in the way you want, don't worry. Just select the code you want to change.
Right click and click "transform code". An input box will appear
where you can type how exactly you want
to transform your code. Let's say that instead
of the recursive function that we have here, I want
to implement an iterative version. I will type change
to iterative function. Click transform and Ghostwriter will
show me the code that satisfies my request. If I want to replace my whole code
with this newer version, all I have to do is to
click replace section or I can manually copy
and paste it myself. I'm going to test my
iterative function with several cases to make
sure that it still works, the same as my
recursive one, and it does. This transformation feature
saves you so much time and stress, especially when you
make bigger mistakes that will require hours of
manual coding to fix them. Ghostwriter does
the thinking, the typing, and the debugging for you
to give you the clean and functional code you want
in only a matter of seconds. Recently, Replit also released
Ghostwriter Chat, an AI assistant you can communicate with about
your code or related questions. Similar to ChatGPT, you can
have a conversation with Ghostwriter about your code or related topics
from anything general to specific. To start chatting, click on the Ghostwriter
under the tools in the bottom left. And the tab next to your console will open up where you
can start chatting away. Replit is convenient, easy to use, and has everything you
could ever want in an AI tool. I encourage you all to experiment
with Ghostwriter's main features for yourself so that you can
live your best coding experience. AI often get a bad rap
for making coding easier because developers won't
have to know or learn as much, but in reality, AI like
Ghostwriter actually stimulates developer's
productivity and growth. We can learn so much
from AI pair programmers, including debugging, coding
conventions, algorithms and so much more. If you like to learn more
about other AI tools you can use to boost your
productivity as a developer, check out my recent video, click in the description. Till next time stay safe!