Shembull: Thirrja e funksionit anonim nëpërmes një variabli

package main

import (
    "fmt"
)

func main() {
    var a = func(item string) bool {
        if item == "water" {
            return true
        }
        return false
    }

    fmt.Println(a("water"))
    fmt.Println(a("air"))
}

https://play.golang.org/p/RYaTuySZ184

Rezultati:

true
false
All Rights Reserved Theme by 404 THEME.