Level up your Go skills with this map access trick! 🧠
Check for key existence and use the value—all in one clean line! ⚡
package main
import "fmt"
func main() {
m := map[string]int{"age": 25}
if val, ok := m["age"]; ok {
fmt.Println("Age is", val)
}
}
#golang #go #programming #coding #easycode #gotips #devshorts 🚀
コメント