Learn

Great, we were able to use the Go compiler to build an executable. We can run that executable as many times as we want.

But what happens if we ever wanted to change our program? We would have to compile another executable file and then run that file. Imagine having to do that every single time!

Thankfully, we have the go run command followed by the name of the Go file. We can use the go run command like so:

go run greet.go

The go run command compiles the code (like go build) and executes it. Unlike go build, go run will NOT create an executable file in our current folder.

Instructions

1.

We provided the same Go file as the previous exercise.

This time, compile and run the main.go file in a single command.

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?