package main
import (
"fmt"
)
func filterKataKasar(kata string)string{
if kata == "anjing"{
return "*censored*"
}else{
return kata
}
}
//Jika fungsi panjang bisa memakai type
type Filter func(string)string
func printKalimat(nama string, filter Filter){
namaFiltered := filter(nama)
fmt.Println("Hello", namaFiltered)
}
func main() {
printKalimat("anjing", filterKataKasar)
}