Sunday, 27 September 2020

golang 7 function 2

 package main

import "fmt"

func main() {
result := func(x int) int {
return x * -1
}(8)
fmt.Println(result)
}

//cmd
C:\Users\bob\golang1>go run tutorial.go
-8

reference:

No comments:

Post a Comment