Skip to main content

Posts

Showing posts with the label Collections of Golang

Collections of Golang

  Overview I have discussed data type and other basic stuff on the previous blog. Pleas check that blog by clicking on this link  . in this blog i am going to talk about the topic below Array Slice Map Structs   Array An array is a fixed size collection of similar data type .  In golang you can declare array in two way implicate and explicate. in explicate initialization you need to initialize array as bellow.      var < name> [< size> ] < type> in implicate initialization you need to initialize array as bellow.      <name> := [ <size> ] <type> {} for implicate initialization you don't have to say size of the array if your not sure of the size. compiler will automatically increase the size as you go on farther. Code : var i int package main import ( "fmt" ) func main() { var arr [3]int arrSecond := [3]int{15,45,85} arrthird...