Skip to content

The introduction application in golang that returns a greeting for the specified person.

Notifications You must be signed in to change notification settings

birdalugur/greetings

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

greetings

The startup application in golang that returns a greeting for the specified person.

usage

Let's write the following code into the file named hello.go:

package main

import (
	"fmt"

	"github.com/ugurpy/greetings"
)

func main() {
	message, err := greetings.Hello("uğur")
	if err != nil {
		fmt.Println(err)
	}
	fmt.Println(message)

	// A slice of names for Hellos func.
	names := []string{"Birdal", "Uğur", "Eren"}

	messages, err2 := greetings.Hellos(names)

	if err2 != nil {
		fmt.Println(err2)
	}

	for _, msg := range messages {
		fmt.Println(msg)
	}

}

add dependencies to current module and install them:

➜ go get github.com/ugurpy/greetings

Let's run the code:

➜ go run hello.go
Hi, uğur. Welcome!
Hi, Birdal. Welcome!
Hi, Uğur. Welcome!
Hi, Eren. Welcome!

About

The introduction application in golang that returns a greeting for the specified person.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages