#1 India's Top IT Training Institute

×

About Uncodemy

Know more about who we are and what we stand for.

About Us

About Us

Discover our mission to equip individuals with essential IT skills and industry expertise.

Read More →
UnCodeMy Gallery

UnCodeMy Gallery

Explore highlights from our IT training sessions and success stories.

Read More →
×

Free Resources

Learn, practice and plan your career — bilkul free.

Tutorials

Tutorials

Step-by-step written tutorials to learn any technology at your own pace.

Read More →
Free Counselling

Free Counselling

Book a free video counselling session and pick the right course for you.

Read More →
Online Compiler

Online Compiler

Write, run and test your code online — no setup required.

Read More →
Fundamentals

Go Variables and Data Types Explained with Practical Examples

Declaring Variables in Go

var name string = "Alice"
var age int = 25
count := 10          // short variable declaration (type inferred)

Basic Data Types

  • Numeric types — int, int8/16/32/64, float32, float64
  • Boolean — bool, holds true or false
  • String — string, an immutable sequence of bytes
  • Complex types — complex64, complex128 (rarely used)

Zero Values

Unlike some languages, Go initializes variables to a "zero value" if not explicitly assigned — 0 for numbers, "" for strings, and false for booleans.

var x int      // x = 0
var s string   // s = ""
var b bool     // b = false

Ready to master real-world Go skills?

Learn Go hands-on with mentor-led, live sessions.

Explore Course