What is Go and why should you learn it?
Go (or Golang) is a programming language that was created by Google engineers in 2009. It was invented to make programs that work quickly, are easy to write and maintain. If you want to learn how to create websites, servers, or applications, Go is a great choice to start with.

Why is Go so popular?
Go is chosen because it:
Simple
Go was specially made so that it was easy to understand even for beginners. You don't need to memorize complex rules or learn a lot of new concepts.Fast
Go programs run very fast because they are compiled into machine code (this is what your computer understands).Modern
Go is ideal for the Internet, servers, and large applications that work with many users.Powerful for multitasking
Go allows you to run multiple tasks at the same time, which makes it convenient for creating servers and programs that work with large data streams.
Where is Go used?
Websites and servers
Many companies, such as Google, Dropbox, and Netflix, use Go to create their servers that process millions of requests.Microservices
These are small programs that perform a single task, such as sending messages or saving data. Go is perfect for creating them.Cloud services
Go is used to create programs that run in the cloud (for example, on Amazon or Google servers).Developer tools
Many programs that help developers write code are made in Go.
Examples of programs in Go
1. First program: "Hello, World!"
Let's write a simple program that prints the text "Hello, World!" (Hello, world!) to the console.
package main
import "fmt"
func main() {
fmt.Println("Hello, World!")
}Explanation:
package mainsays that this is the main program that will be executed.import "fmt"connects thefmtlibrary, which can display text.func main()is the main function from which the program execution begins.fmt.Println("Hello, World!")outputs text to the console.
Program result:
Hello, World!2. Variables
Variables are like boxes where you put data (for example, text or numbers) to use them later. In Go, variables can be declared in two ways.
Example:
package main
import "fmt"
func main() {
var name string = "Alice" // Declare a variable name and put the text "Alice" there
age := 12 // We put the number 12 in the age variable (Go itself understands that this is a number)
fmt.Println("Name:", name) // Display the name variable
fmt.Println("Age:", age) // Displaying the age variable
}Explanation:
varis used to explicitly specify the data type.:=allows you to quickly create a variable without explicitly specifying its type.
Program result:
Name: Alice
Age: 123. Conditional operators
The conditions allow the program to make decisions. For example, if the age is greater than 18, we will say that the person is an adult.
package main
import "fmt"
func main() {
age := 16
if age >= 18 {
fmt.Println("You are an adult.") // This will be done if the age is 18 or more
} else {
fmt.Println("You are not an adult.") // This will be done if the age is less than 18
}
}Program result:
You are not an adult.4. Cycles
Loops allow you to perform the same action multiple times. For example, you can display a message 5 times.
Example:
package main
import "fmt"
func main() {
for i := 1; i <= 5; i++ {
fmt.Println("Iteration:", i) // Display the iteration number
}
}Explanation:
for i := 1; i <= 5; i++means that the variableiwill start with 1, increase by 1 after each iteration, and end with 5.fmt.Println("Iteration:", i)displays the current iteration number.
Program result:
Iteration: 1
Iteration: 2
Iteration: 3
Iteration: 4
Iteration: 55. Functions
Functions allow you to collect code into blocks to avoid repetitions.
Example:
package main
import "fmt"
func greet(name string) { // Create a function that takes a name
fmt.Println("Hello,", name)
}
func main() {
greet("Alice") // Call the function named Alice
greet("John") // Calling a function named John
}Explanation:
func greet(name string)is a function definition with one parametername.Calling the
greet("Alice")function passes the "Alice" string to thenameparameter.
Program result:
Hello, Alice
Hello, JohnWhy learn Go?
Easy start
Go is one of the easiest languages to learn. You will be able to write working programs quickly.Modern language
Go is used to create servers and services that handle millions of requests. This makes it useful for modern technologies.Job prospects
Many companies are looking for Go developers because the language is popular and actively used in the industry.
Conclusion
Go is a simple and powerful programming language that is suitable for creating servers, websites and modern applications. Thanks to its clarity, you can quickly start writing your programs. Try the examples from this article and make sure that programming in Go is interesting and easy!
