From d85dd833ed835505a313f73d65a07908d422b5d3 Mon Sep 17 00:00:00 2001 From: Rain Miao Date: Wed, 25 Aug 2021 19:00:40 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=B8=A6=E5=8F=98=E9=87=8F?= =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=E7=9A=84if=E8=AF=AD=E5=8F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- languages/golang.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/languages/golang.go b/languages/golang.go index 921d840..665211c 100644 --- a/languages/golang.go +++ b/languages/golang.go @@ -149,6 +149,11 @@ if i == 10 { } else { println("i != 10") } +// if with init +m := map[int]int{1:1} +if v, ok := m[1]; ok { + println(v) +} // switch switch i { case 10: