Function as Parameter

Run Settings
LanguageGo
Language Version
Run Command
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) }
Editor Settings
Theme
Key bindings
Full width
Lines