Skip to content

morganhoward/gopl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 

Repository files navigation

Just working through The Go Programming Language book by Donovan and Kernighan.

:= is short variable delcaration

++ and -- are statements, not expressions, so i++ is valid, but j = i++ is not

_ is the blank identifier

Preferred init of strings

When the initial value is important

// can't be used for package level variables s := ""

When the default value for the type, "" for strings, is okay

var s string

Loops

for loop

for initialization; condition; post { ... }

traditional while loop

for condition { ... }

infinite loop

for {

}

loop over range

for _, arg := range slice { ... }

Structs

type person struct { name string age int }

joe := person{ name: "John", age: 32, }

joe.name

About

go programming language book exercises

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages