@@ -1856,6 +1856,67 @@ composite type appears in a type list.
1856
1856
It does not apply when a composite type is formed from a type
1857
1857
parameter outside of a type list, as in ` var v []T ` for some type
1858
1858
parameter ` T ` .
1859
+ ##Arrays
1860
+ Arrays can be reffered to as a __ list__ of iteams of the same type.
1861
+ Go's Arrays are fixed size,this means that during declaration,you must specify
1862
+ the size of array and type it will contain,these cannot be change at runtime.
1863
+ ...GO
1864
+ var children[ 2] string
1865
+ children[ 0] = "Elves"
1866
+ //or
1867
+ children := [ 2] string{"Elves","Men"}
1868
+
1869
+ We can use 'len' to get the length of the array.For cases where we don't know
1870
+ the number of elements we'll be dealing with upfront,we can turn to slices.
1871
+ ##Slices
1872
+ Slices are lightweight structures that represent a portion of an array. You'll
1873
+ most likely use slices way more than you'll be using Arrays in your programs.
1874
+ ...go 0 1
1875
+ children :=[ ] string{"Elves","Men"}
1876
+ //or
1877
+ children := make([ ] string,2,5)
1878
+ A slices can also be created from an existing array
1879
+ ...go 0 1 2 3 4 5 6
1880
+ valar := [ 7] string{"Manwe","Ulmo","Aule","Yavanna","Varda","Este","Nienna"}
1881
+ ladies := valar[ 2:]
1882
+ ...
1883
+ ##Maps
1884
+ Maps are key - value pairs structure. In some language ,they are called Hashtables or
1885
+ Dictionaries.
1886
+ ...go
1887
+ clans:= make(map[ string] string)
1888
+ clans[ "Feanor"] = "Noldo Elves"
1889
+
1890
+ //or
1891
+ clans := map[ string] string{
1892
+ "Feanor" : "Noldo",
1893
+ }
1894
+ //get the length
1895
+ l := len(clans)
1896
+ //Delete
1897
+ delete(clans,"Noldo")
1898
+ ...
1899
+ ##Structs
1900
+ A struct is a data type that aggregates different kinds of data values of different types. A
1901
+ classic example of a struct would be the data representation of the COVID19 status in Nigeria.
1902
+ ...go
1903
+ type COVID19Stats struct {
1904
+ Country string
1905
+ NumberOfCases int
1906
+ Safety SafetyMeasures
1907
+ }
1908
+ type SafetyMeasures struct {
1909
+ First string
1910
+ Second string
1911
+ Third string
1912
+ }
1913
+ ...
1914
+ Note : If you want output in JSON format thenthe first letter of field name(Country,NumberOfCases,Safety)
1915
+ in struct should be uppercase.
1916
+
1917
+
1918
+
1919
+
1859
1920
1860
1921
```
1861
1922
// structField is a type constraint with a list of structs that all
0 commit comments