Go Maps: Difference between revisions
Jump to navigation
Jump to search
Line 16: | Line 16: | ||
==<span id='Composite_Literal'></span>Initialization with a Composite Literal== | ==<span id='Composite_Literal'></span>Initialization with a Composite Literal== | ||
Composite literals can be used for map initialization. | Composite literals can be used for map initialization. | ||
[[Go_Variables#Variable_Initialization_with_Type_Inference_in_Long_Declaration|Long variable declaration and initialization with type inference]]: | [[Go_Variables#Variable_Initialization_with_Type_Inference_in_Long_Declaration|Long variable declaration and initialization with type inference]]: | ||
<syntaxhighlight lang='go'> | <syntaxhighlight lang='go'> |
Revision as of 23:34, 26 August 2024
External
Internal
Overview
Maps and Pass-by-Value
Pointers to Maps
nil and Empty Map
nil Map
Empty Map
Declaration and Initialization
Initialization with make()
Initialization with a Composite Literal
Composite literals can be used for map initialization.
Long variable declaration and initialization with type inference:
var mm = map[string]int {"A:1, "B":2}
mm := map[string]int {"A:1, "B":2}