How Do You Use a Function in Golang?

Problem scenario
You are trying to learn to program in Go. How do you use a function?

Solution
Prerequisite
This assumes that you have installed Golang; if you need assistance with this, see this posting.

Procedures
1. Create a file called b.go with this as the content:

package main

import "fmt"

// ContintFunction will display a message
func ContintFunction() {
        fmt.Println("Hello from Continual Integration")
}

func main() {
        ContintFunction()
}

2. Run it like this: go run b.go

Leave a comment

Your email address will not be published. Required fields are marked *