Skip to content

Collection of exercises and experimental code with Go

License

Notifications You must be signed in to change notification settings

emrivero/learning-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Learning Go

The newbie way

Gopher art-work by egonelbre

Index

  1. Variable declarations
    • var keyword
    • Short assigment :=

Content

1. Variable declarations

  • varkeyword
// Typed declarations
var number int = 2 
var flag bool = true
var name string = "Jonh Doe"

// Untyped declarations
var number = 2 
var flag = true
var name = "Jonh Doe"

// You can also group by types
var a, b int = 2, 3

// Untyped version
var a, b = 2, 3

// This way is also correct
var (
      a int = 2
      b bool = false
)

// Untyped version
var (
      a = 2
      b = false
)

// You can also declarate the variable
// and initialize in separate lines
var b int
b = 10

var a string
a = "Hello, Go!"

About

Collection of exercises and experimental code with Go

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages