# Hello World

We'll delve into a simple yet fundamental Go program that prints "hello world" to the console.

## Code Breakdown

```go
package main

import "fmt"

func main() {
    fmt.Println("hello world")
}
```

## Output

```
hello world
```

Let's break down the code step by step:

* **`package main`**: Every Go program starts with a `package` declaration. The `main` package is special; it indicates that this is an executable program rather than a library.
* **`import "fmt"`**: This line imports the "fmt" package, which stands for format. It provides functions for formatting input and output, including printing to the console.
* **`func main()`**: The `main` function is the entry point of every Go program. When the program starts, it's the `main` function that gets executed.
* **`fmt.Println("hello world")`**: This line uses the `Println` function from the "fmt" package to print "hello world" followed by a newline to the console.

## Running the Program 🏃

To run this program, follow these steps:

1. Ensure you have Go installed on your system.
2. Copy the code into a file with a ".go" extension, for example, `hello-world.go`.
3. Open a terminal and navigate to the directory containing your file.
4. Run the command `go run hello-world.go`.
5. You should see the output: `hello world`.

## Building and Running as a Binary ⚙️

Alternatively, you can build the program into a binary and run it separately:

1. In the same directory as your code, run `go build hello-world.go`. This will create an executable file named `hello-world` (or `hello-world.exe` on Windows).
2. Execute the binary by running `./hello-world` (or `hello-world.exe` on Windows) in the terminal.

## Conclusion

Congratulations! 🎉 You've just created and executed your first Go program. This simple "Hello World" example sets the stage for exploring more advanced concepts in Go.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ineelhere.gitbook.io/code-with-go/01-hello-world.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
