SyntaxStudy
Sign Up
Go Introduction to Go
Go Beginner 8 min read

Introduction to Go

Go (also called Golang) is a statically typed, compiled programming language designed at Google. It emphasizes simplicity, safety, and efficiency. Go is particularly well-suited for concurrent programming, building web servers, microservices, and command-line tools.

Go compiles to a single binary with no dependencies, making deployment simple and fast.

Example
// main.go
package main

import (
	"fmt"
	"strings"
)

func main() {
	fmt.Println("Hello, Go!")

	// Variables
	name := "Alice"  // short declaration
	var age int = 30
	
	fmt.Printf("Name: %s, Age: %d\n", name, age)

	// Slices (dynamic arrays)
	fruits := []string{"apple", "banana", "cherry"}
	fruits = append(fruits, "date")
	fmt.Println(fruits)

	// Maps
	scores := map[string]int{
		"Alice": 95,
		"Bob":   87,
	}
	scores["Charlie"] = 92
	
	// Range loop
	for name, score := range scores {
		fmt.Printf("%s: %d\n", name, score)
	}

	// String operations
	upper := strings.ToUpper("hello")
	fmt.Println(upper)
}