Google's Bard AI can now write code - here's how to use it

Google Bard on phone with Google logo in background
(Image credit: Shutterstock)

Google is not resting on its laurels when it comes to improving its Google Bard AI. After supercharging its math abilities earlier this month, Bard has now had a coding lesson too. 

In a press release, Group Project Manager for Google Research Paige Bailey confirmed the additional features added to the chatbot. “Starting now, Bard can help with programming and software development tasks, including code generation, debugging and code explanation.” 

This is, of course, a great way for developers to create code quickly and also get a second pair of ‘eyes’ on existing work to spot any errors. 

Coders can choose from 20+ different coding languages too, including C++, Go, Java, Javascript, Python, and Typescript. If you don’t know where to start, newbie coders can also use Bard to explain snippets of code to them in terms they understand.

Bailey does understandably caveat for keen coders that Bard is still an experiment and, “when it comes to coding, Bard may give you working code that doesn’t produce the expected output, or provide you with code that is not optimal or incomplete.” Before using any code from Bard, it's obviously sensible to double-check and test it. Bard can even fix its own code if prompted.

This improvement is a major closing of the gap between Bard and ChatGPT and proves even with the upcoming Project Magi, Google is pushing new features into Bard. For example, another addition is the confirmation that, “If Bard quotes at length from an existing open-source project, it will cite the source.”  That's something we preferred about ChatGPT in our comparison of the two

How will you be able to write code with Google Bard? 

Programmer sitting at a laptop and monitors

(Image credit: Shutterstock)

The great thing about coding with chatbots like ChatGPT and Google Bard is you won’t need background knowledge in programming to log in and get started. You simply have to know what prompt to provide the AI and a basic understanding of how to use Google Bard.

Getting the best results from AI for a task is all about being specific, much like a search engine. Telling the AI exactly what you want and what language to use is crucial. For example, don’t say, “Code me a game” try “Code me a pong-style game in Python” instead and see what comes back at you. 

Once you’ve got the first round of code, make sure to optimize it. Again, this can be done with little technical knowledge because of the way conversational AI is set up. You can, for instance, ask Bard “can you make that faster?” or “can you fix any errors you’ve missed?”

It will, of course, be trial and error at first. And we haven't had a chance to test Bard's coding skills first hand. But, once we've given it a try, we'll make sure to report back with our findings. 

How long until we see the first AAA blockbuster game or killer app created by an AI?

More from Tom's Guide

Andy Sansom
Trainee Writer

Andy is Tom’s Guide’s Trainee Writer, which means that he currently writes about pretty much everything we cover. He has previously worked in copywriting and content writing both freelance and for a leading business magazine. His interests include gaming, music and sports- particularly Formula One, football and badminton. Andy’s degree is in Creative Writing and he enjoys writing his own screenplays and submitting them to competitions in an attempt to justify three years of studying.