golang-examples: github.com/mycodesmells/golang-examples/misc/examples Index | Examples | Files

package examples

import "github.com/mycodesmells/golang-examples/misc/examples"

Code:

main()

Output:

Hello, world!

Index

Examples

Package Files

main.go sum.go user.go

func Sum Uses

func Sum(a, b int)

Code:

Sum(1, 5)

Output:

1 + 5 = 6

Code:

Sum(-3, -9)

Output:

-3 + -9 = -12

Code:

Sum(0, 0)

Output:

0 + 0 = 0

type User Uses

type User struct {
    Name string
}

func (User) Hi Uses

func (u User) Hi()

Code:

u := User{"Timmy"}
u.Hi()

Output:

Hi, my name is Timmy!

Package examples imports 1 packages (graph). Updated 2017-10-27. Refresh now. Tools for package owners.