I am confused about a syntax usage in Go.
func f(){
m := map[int]string{1: "one", 2: "two"}
if x, ok := m[3]; !ok{
// do something
}
}
I understand what if x, ok := map[3]
does, but I am confused about the difference between either have a ; !ok
or a ; ok
at the end, and the meaning of those two.
By the way, is it valid if I only write if x, ok := map[3]
without a ;
that extends it?
Thank you!