Retourner au contenu associé (dépêche : Retour d'expérience sur Go)
Posté par Sebastien le 16 mai 2012 à 17:48. En réponse à la dépêche Retour d'expérience sur Go. Évalué à 10.
Son nom est suffisamment explicite : une clé, une valeur. Problème selon moi : si la clé ne correspond à aucune valeur, la valeur nulle est renvoyée.
pour ca, il y a le "comma-ok":
_, ok := my_map[my_key] if ok { fmt.Printf("err: the key [%v] is already in the map!\n", my_key) }
ou, plus go-ish:
if _,ok := my_map[my_key]; ok { fmt.Printf("err: the key [%v] is already in the map!\n", my_key) }
-s
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
# maps
Posté par Sebastien . En réponse à la dépêche Retour d'expérience sur Go. Évalué à 10.
pour ca, il y a le "comma-ok":
ou, plus go-ish:
-s