Skip to content

Instantly share code, notes, and snippets.

@bxcodec
Last active April 12, 2017 08:07
Show Gist options
  • Save bxcodec/8d1a04270a594ee5da3d9c00ce08f17b to your computer and use it in GitHub Desktop.
Save bxcodec/8d1a04270a594ee5da3d9c00ce08f17b to your computer and use it in GitHub Desktop.
Using Saint
package main
import (
"fmt"
"github.com/bxcodec/saint"
)
func main() {
arr:=[] int {2,1,3,5,6} // array of integers
var x int
x= saint.Max(arr...) // get the maximun value from the array
fmt.Println(x) // 6
x= saint.Max(4,3,1,5,7) // get the maximun value from the parameters inserted
fmt.Println(x) // 7
x= saint.Min(arr...) // get the minimun value from the array
fmt.Println(x) // 1
x= saint.Min(4,3,5,5,7)
fmt.Println(x) // 3
x= saint.Sum(arr...) // sum all of value in the array
fmt.Println(x) // 17
x = saint.Sum(4,5) // sum between 2 numbers
fmt.Println(x) // 9
x = -5
fmt.Println(saint.Abs(x)) // Get the absolute value from the x
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment