Last active
August 22, 2024 14:19
-
Star
(235)
You must be signed in to star a gist -
Fork
(63)
You must be signed in to fork a gist
-
-
Save honkskillet/bd1f72223dd8e06b5ce6 to your computer and use it in GitHub Desktop.
Revisions
-
honkskillet revised this gist
Sep 2, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -271,7 +271,7 @@ for index, element := range mySlice { fmt.Println(index, element) //will print "0 a", etc... } ``` If you don't care about the index, you can use **_** instead of a variable. **_** indicates we expect a variable to be returned, but we don't care about it's value. On the other hand, if we don't care about the element, we can simply exclude ```, element```. ```go iq := map[string]int{"UT": 115, "OU": 90, "A&M": 75} for index := range iq { -
honkskillet revised this gist
Sep 2, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -248,7 +248,7 @@ for ; counter>0; { counter -- } ``` At this point, our ```for``` loop functions identically to a while loop. In fact, there are no while or do-while loops in Go at all. The syntax for the for/while loops can be simplified further by ommitting the **;**s. ```go counter := 10 for counter>0 { //a while loop in go -
honkskillet revised this gist
Feb 1, 2015 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -860,8 +860,8 @@ func main() { ``` ### golang 16 - maps <a href="http://www.youtube.com/watch?feature=player_embedded&v=ulZLAgf0SpY " target="_blank"><img src="http://img.youtube.com/vi/ulZLAgf0SpY/mqdefault.jpg" alt="YOUTUBE VIDEO TUTORIAL" border="5" bordercolor="#ff0000" /></a> In Go, in addition to arrays and slices, there is a collection that stores key/value pairs. In Go this is called a map. Other languages sometimes call these hashes, dicts or dictionaries. The type of a map includes the type of the key and type of value. Declaration and initialization syntax is as follows. -
honkskillet revised this gist
Feb 1, 2015 . 1 changed file with 6 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -864,21 +864,21 @@ func main() { " target="_blank"><img src="http://img.youtube.com/vi/z-ulZLAgf0SpY/mqdefault.jpg" alt="YOUTUBE VIDEO TUTORIAL" border="5" bordercolor="#ff0000" /></a> In Go, in addition to arrays and slices, there is a collection that stores key/value pairs. In Go this is called a map. Other languages sometimes call these hashes, dicts or dictionaries. The type of a map includes the type of the key and type of value. Declaration and initialization syntax is as follows. ```go var aMap map[string]int //where string is the type for the key and int is the type for the value aMap = map[string]int{} //set aMap equal to an empty map bMap := map[string]int{} //shorthand ``` You can add a key/value pair to a map using ```[]```s. ```go aMap["a"]=1 //aMap now contain the value 1 for the key "a" ``` Use the built in delete function to remove a key/value pair. The first parameter is the map variable, the second is the key. ```go delete(aMap,"a") ``` Note that if you try to retrieve a value for a key that does not exist in a map, the value that is returned will be equal to the default for the value type. That is, if the values in your map are ints, you'll get back 0 for a non existant key. If the values are string, you'll get back "". The trouble is, the default value is always a *valid* value. To clarify whether a key/value pair exists, retrieval from a map actually returns two values. First, the value for the key. Second, a boolean which indicates whether the key exists in the map. For example, ```go func main() { myMap := map[string]int{}//declare a map and initialize to an empty map @@ -887,8 +887,8 @@ func main() { fmt.Println(val, ok) //add some key value pairs myMap["a"]=0 myMap["b"]=1 myMap["c"]=2 //use if statement to check to see if there is a key value pair for key "a" if val, ok = myMap["a"]; ok{ fmt.Println("there is a value for the a key") -
honkskillet revised this gist
Feb 1, 2015 . 1 changed file with 47 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -18,6 +18,7 @@ by alexander white © - [13 - arrays](https://gist.github.com/honkskillet/bd1f72223dd8e06b5ce6#golang-13---arrays) - [14 - slices](https://gist.github.com/honkskillet/bd1f72223dd8e06b5ce6#golang-14---slices) - [15 - variadic functions](https://gist.github.com/honkskillet/bd1f72223dd8e06b5ce6#golang-15---variadic-functions) - [16 - maps](https://gist.github.com/honkskillet/bd1f72223dd8e06b5ce6#golang-16---maps) Youtube: [link to playlist](https://www.youtube.com/playlist?list=PLB-tlgQ97VrdH1qcBKTghZQ09Qy5P1g2K&spfreload=10) @@ -858,13 +859,58 @@ func main() { } ``` ### golang 16 - maps <a href="http://www.youtube.com/watch?feature=player_embedded&v=z-ulZLAgf0SpY " target="_blank"><img src="http://img.youtube.com/vi/z-ulZLAgf0SpY/mqdefault.jpg" alt="YOUTUBE VIDEO TUTORIAL" border="5" bordercolor="#ff0000" /></a> In Go, in addition to arrays and slices, there is a collection that stores key/value pairs. In Go this is called a map. Other languages sometimes call these types of collections hashes, dicts or dictionaries. A type of a map includes the type of the key and type of value. Declaration and initialization syntax is as follows. ```go var aMap map[string]int //where string is the type for the key and int is the type for the value aMap = map[string]int{} //set aMap equal to an empty map bMap := map[string]int{} //shorthand ``` You can add a key value a pair a map using ```[]```s. ```go aMap["a"]=1 //aMap now contain the value 1 for the key "a" ``` Use the built in delete function to remove a key value pair. The first parameter is the map, the second is the key. ```go delete(aMap,"a") ``` Note that if you try to retrieve a value for a key that does not exist in a map, the value that is returned will be equal to the default for the value type. That is if the values in your map are ints, you'll get back 0 for a non existant key. If the values are string, you'll get back "". The trouble is, the default value is always a *valid* value. To clarify whether a key/value pair exists, retrieval from a map actually returns two values. First, the value for the key. Second, a boolean which indicates whether the key exists in the map. For example, ```go func main() { myMap := map[string]int{}//declare a map and initialize to an empty map //check to see if there is a key value pair for key "a" val, ok := myMap["a"] //val is an int, ok is bool fmt.Println(val, ok) //add some key value pairs myMap["a"]=0 myMap["b"]=2 myMap["c"]=3 //use if statement to check to see if there is a key value pair for key "a" if val, ok = myMap["a"]; ok{ fmt.Println("there is a value for the a key") fmt.Println(val, ok) } } ``` Notice it is convenient to retrieve the value for a key and the existance of a key/value pair within a Go for statement. The output for the above code would be... ``` 0 false there is a value for the a key 1 true ``` ### to do - [x] if-else statements - [x] switch statements - [x] structs - [x] arrays - [x] slices - [x] maps - [ ] defers - [x] methods - [x] interfaces -
honkskillet revised this gist
Jan 31, 2015 . 1 changed file with 2 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -809,9 +809,8 @@ If we call it after the loop, when slice is using a different block of memory, t ``` ### golang 15 - variadic functions <a href="http://www.youtube.com/watch?feature=player_embedded&v=z-_TeYezb9Q " target="_blank"><img src="http://img.youtube.com/vi/z-_TeYezb9Q/mqdefault.jpg" alt="YOUTUBE VIDEO TUTORIAL" border="5" bordercolor="#ff0000" /></a> A variadic function in Go is a function that can take a variable number of parameter. An example of a variadic function is ```fmt.Println()```. The variardic parameter is declared with the format **parameterName ...elementType**. **parameterName** would then be available as a slice of type **[]elementType** within the body of the function. For example, -
honkskillet revised this gist
Jan 31, 2015 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -16,8 +16,8 @@ by alexander white © - [11 - interfaces](https://gist.github.com/honkskillet/bd1f72223dd8e06b5ce6#golang-11---interfaces) - [12 - closure](https://gist.github.com/honkskillet/bd1f72223dd8e06b5ce6#golang-12---closure) - [13 - arrays](https://gist.github.com/honkskillet/bd1f72223dd8e06b5ce6#golang-13---arrays) - [14 - slices](https://gist.github.com/honkskillet/bd1f72223dd8e06b5ce6#golang-14---slices) - [15 - variadic functions](https://gist.github.com/honkskillet/bd1f72223dd8e06b5ce6#golang-15---variadic-functions) Youtube: [link to playlist](https://www.youtube.com/playlist?list=PLB-tlgQ97VrdH1qcBKTghZQ09Qy5P1g2K&spfreload=10) -
honkskillet revised this gist
Jan 31, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -17,7 +17,7 @@ by alexander white © - [12 - closure](https://gist.github.com/honkskillet/bd1f72223dd8e06b5ce6#golang-12---closure) - [13 - arrays](https://gist.github.com/honkskillet/bd1f72223dd8e06b5ce6#golang-13---arrays) - [14 - slices]( https://gist.github.com/honkskillet/bd1f72223dd8e06b5ce6#golang-14---slices) - [15 - variadic functions]( https://gist.github.com/honkskillet/bd1f72223dd8e06b5ce6#golang-15---variadic functions) Youtube: [link to playlist](https://www.youtube.com/playlist?list=PLB-tlgQ97VrdH1qcBKTghZQ09Qy5P1g2K&spfreload=10) -
honkskillet revised this gist
Jan 31, 2015 . 1 changed file with 52 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -17,6 +17,7 @@ by alexander white © - [12 - closure](https://gist.github.com/honkskillet/bd1f72223dd8e06b5ce6#golang-12---closure) - [13 - arrays](https://gist.github.com/honkskillet/bd1f72223dd8e06b5ce6#golang-13---arrays) - [14 - slices]( https://gist.github.com/honkskillet/bd1f72223dd8e06b5ce6#golang-14---slices) - [15 - variadic functions]( https://gist.github.com/honkskillet/bd1f72223dd8e06b5ce6#golang-14---variadic functions) Youtube: [link to playlist](https://www.youtube.com/playlist?list=PLB-tlgQ97VrdH1qcBKTghZQ09Qy5P1g2K&spfreload=10) @@ -807,6 +808,56 @@ If we call it after the loop, when slice is using a different block of memory, t [-5 2 3 90 91 92 93 94 95 96 97 98 99] ``` ### golang 15 - variadic functions (video pending) <a href="http://www.youtube.com/watch?feature=player_embedded&v=CESkOA5kR3M " target="_blank"><img src="http://img.youtube.com/vi/CESkOA5kR3M/mqdefault.jpg" alt="YOUTUBE VIDEO TUTORIAL" border="5" bordercolor="#ff0000" /></a> A variadic function in Go is a function that can take a variable number of parameter. An example of a variadic function is ```fmt.Println()```. The variardic parameter is declared with the format **parameterName ...elementType**. **parameterName** would then be available as a slice of type **[]elementType** within the body of the function. For example, ```go func vardiacFun( params ...int){ fmt.Printf("Parameter type: %T\n",params) fmt.Println(params) for _,elem :=range params{ //loop of the parameter fmt.Println(elem) } } func main() { vardiacFun(1,3,4,5,6) } ``` This would yield the following output. ``` Parameter type: []int [1 2 3 4 5] 1 2 3 4 5 ``` A variadic function can have more than just the variadic parameter, but the variadic parameter must be the last parameter. ```go func vardiacFun( s1, s2 string, params ...int){ //variadic parameter must come last //do something here } ``` If it is your preference, you can always avoid using a variadic function by using a normal slice as a parameter. We can rewrite our first example in a nonvariadic style as below. The bodies of ```variadic()``` and ```nonvariadic()``` are identical. The differences are in the functions' declarations and how they are called in ```main()```. ```go func nonVardiacFun( params []int){ fmt.Printf("%T\n",params) fmt.Println(params) for _,elem :=range params{ fmt.Println(elem) } } func main() { nonVardiacFun([]int{1,2,3,4,5}) } ``` ### to do - [x] if-else statements @@ -820,7 +871,7 @@ If we call it after the loop, when slice is using a different block of memory, t - [x] interfaces - [ ] errors - [x] closure - [x] variadic functions - [ ] go routines - [ ] channels - [ ] select -
honkskillet revised this gist
Jan 31, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -813,7 +813,7 @@ If we call it after the loop, when slice is using a different block of memory, t - [x] switch statements - [x] structs - [x] arrays - [x] slices - [ ] maps - [ ] defers - [x] methods -
honkskillet revised this gist
Jan 31, 2015 . 1 changed file with 6 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -721,7 +721,7 @@ This yields the following output. Notice changes to one array do not effect the " target="_blank"><img src="http://img.youtube.com/vi/CESkOA5kR3M/mqdefault.jpg" alt="YOUTUBE VIDEO TUTORIAL" border="5" bordercolor="#ff0000" /></a> 90%+ of the time the you work with lists of values in Go, you will be working with slices, not arrays. Slices are an abstraction built on top of arrays. The type of a slice indicates the type of the elements. A slice can contain any number of elements, unlike an array. ```go var mySlice []int // a slice of ints, length is variable var myArray [5]int // a array of ints that is 5 elements long @@ -732,15 +732,15 @@ var aSlice []int //nil slice, len and cap are zero var bSlice = [int]{1,2,3} cSlice := [int]{3,4,5} ``` You can make a slice from an array (or another slice). That is, to take a slice from it. The format is **arrayName[startIndexInclusive:endIndexExclusive]**. You can leave off one or both of the start or end indices. ```go myArray := [6]int{1,2,3,4,5,6} sliceA := myArray[2:5] // value will be {3,4,5} sliceB := myArray[:3] // value will be {0,1,2} silceC := myArray[3:] // claue will be {2,3,4,5,6} sliceD := myArray[:] // value will be {1,2,3,4,5,6} ``` A slice is actually comprised of 3 parts under the hood: a pointer to an element in an array, a length and a capacity. The length is the number of elements in the slice. The capacity is the total number of elements the slice can have before go needs to reallocate memory to hold the slice. For example, take the following main function. ```go func main(){ arrA := [6]int{1,2,3,4,5,6} @@ -755,7 +755,7 @@ The ```"%p"``` formatting allows us to print out the values of pointers. ```&`` 0x2081ba150 0x2081ba150 ``` The slice that we made has a length of 3 and a capacity of 6 (the size of the underlying array). The pointer values for the start of the array and first element of the slice are identical (for now). Currently, Go is using our array as the underlying storage for our slice. We can append elements to the end of a slice using the append function. Lets append a bunch of elements in a for loop. ```go @@ -771,7 +771,7 @@ func main(){ fmt.Println( "\n",arrA,"\n",slcA) //print out the final value of our array and slice } ``` Will render output... ``` [1 2 3 4 5 6] [1 2 3] @@ -796,7 +796,7 @@ Notice a few things. * The location in memory of the values of our slice stays the same until the slice's length exceeds the slice's capacity. At this point, under the hood, Go allocates a new array acciated with a larger contiguous block of memory. The slice's capacity is doubled. Subsequent append calls won't require new memory allocation until the capacity is again exceed (the last append call also exceeds capacity) * The first 3 append calls overwrote the final 3 elements of our original array variable! So be careful when working with both arrays and slices. You may be better off just working with slices. Lastly,consider this. The call ```slcA[0]=-5``` will a have different effect depending of where it is made. If we call it before the for loop, when our array and our slice are sharing memory, our final values will be... ``` [-5 2 3 90 91 92] [-5 2 3 90 91 92 93 94 95 96 97 98 99] -
honkskillet revised this gist
Jan 31, 2015 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -16,7 +16,8 @@ by alexander white © - [11 - interfaces](https://gist.github.com/honkskillet/bd1f72223dd8e06b5ce6#golang-11---interfaces) - [12 - closure](https://gist.github.com/honkskillet/bd1f72223dd8e06b5ce6#golang-12---closure) - [13 - arrays](https://gist.github.com/honkskillet/bd1f72223dd8e06b5ce6#golang-13---arrays) - [14 - slices]( https://gist.github.com/honkskillet/bd1f72223dd8e06b5ce6#golang-14---slices) Youtube: [link to playlist](https://www.youtube.com/playlist?list=PLB-tlgQ97VrdH1qcBKTghZQ09Qy5P1g2K&spfreload=10) ### golang 0 - installation (on a Mac) -
honkskillet revised this gist
Jan 31, 2015 . 1 changed file with 14 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -793,8 +793,20 @@ P:0x2081cd250 L:13 C:24 S:[1 2 3 90 91 92 93 94 95 96 97 98 99] Notice a few things. * The original capacity of our slice matches the original size of our array. * The location in memory of the values of our slice stays the same until the slice's length exceeds the slice's capacity. At this point, under the hood, Go allocates a new array acciated with a larger contiguous block of memory. The slice's capacity is doubled. Subsequent append calls won't require new memory allocation until the capacity is again exceed (the last append call also exceeds capacity) * The first 3 append calls overwrote the final 3 elements of our original array variable! So be careful when working with both arrays and slices. You may be better off just working with slices. Consider this, the call ```slcA[0]=-5``` will a have different effect depending of where we call it. If we call it before the for loop, when our array and our slice are sharing memory, our final values will be... ``` [-5 2 3 90 91 92] [-5 2 3 90 91 92 93 94 95 96 97 98 99] ``` If we call it after the loop, when slice is using a different block of memory, the final values will be... ``` [1 2 3 90 91 92] [-5 2 3 90 91 92 93 94 95 96 97 98 99] ``` ### to do - [x] if-else statements - [x] switch statements -
honkskillet revised this gist
Jan 31, 2015 . 1 changed file with 80 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -715,6 +715,86 @@ This yields the following output. Notice changes to one array do not effect the 0x2081ba180 ``` ### golang 14 - slices <a href="http://www.youtube.com/watch?feature=player_embedded&v=CESkOA5kR3M " target="_blank"><img src="http://img.youtube.com/vi/CESkOA5kR3M/mqdefault.jpg" alt="YOUTUBE VIDEO TUTORIAL" border="5" bordercolor="#ff0000" /></a> In Go 90%+ of the time you will be working with lists of values you will be working with slices, not arrays. Slices are an abstraction built on top of arrays. The type of a slice indicates the type of the elements. A slice can contain any number of elements, unlike an array. ```go var mySlice []int // a slice of ints, length is variable var myArray [5]int // a array of ints that is 5 elements long ``` There are the expected ways to declare a slice. Declaration is very similar to array decalartion. ```go var aSlice []int //nil slice, len and cap are zero var bSlice = [int]{1,2,3} cSlice := [int]{3,4,5} ``` You can make a slice from an array (or another slice). That is, to take a slice from it. The format is **arrayName[startIndexInclusive:endIndexExclusive]**. You can leave of one or both of the start or end indices. ```go myArray := [6]int{1,2,3,4,5,6} sliceA := myArray[2:5] // value will be {3,4,5} sliceB := myArray[:3] // value will be {0,1,2} silceC := myArray[3:] // claue will be {2,3,4,5,6} sliceD := myArray[:] // value will be {1,2,3,4,5,6} ``` A slice is actually comprise of 3 parts under the hood, a pointer to an element in an array, a length and a capacity. The length is the number of elements in the slice. The capacity is the total number of elements the slice can have before go needs to reallocate memory to hold the slice. For example, take the following main function. ```go func main(){ arrA := [6]int{1,2,3,4,5,6} slcA := arrA[0:3] fmt.Println( slcA, len(slcA), cap(slcA)) fmt.Printf("%p\n%p", &arrA, &slcA[0]) } ``` The ```"%p"``` formatting allows us to print out the values of pointers. ```&``` gets of the pointer for a value. In this case we get the pointers to the start of the array and the first element of the slice. This will generate the output... ``` [1 2 3] 3 6 0x2081ba150 0x2081ba150 ``` The slice that we made has a length of 3 and a capacity of 6 (the size of the underlying array). The pointer values for the start of the array and first element of the slice are identical (for now). Currently, our slice is using our array as it's underlying memory block. We can append elements to the end of a slice using the append function. Lets append a bunch of elements in a for loop. ```go func main(){ arrA := [6]int{1,2,3,4,5,6} slcA := arrA[0:3] fmt.Println( "\n",arrA,"\n",slcA,"\n") //print out the value of both our array and slice for i:=0;i<10;i++{ slcA = append (slcA,90+i) //append an int to the end of our []int slice //print out the address of the first element of the slice, the length, the capacity and the value of the slice fmt.Printf("P:%p L:%2v C:%2v S:%v\n", &slcA[0],len(slcA), cap(slcA), slcA,) } fmt.Println( "\n",arrA,"\n",slcA) //print out the final value of our array and slice } ``` Will year output... ``` [1 2 3 4 5 6] [1 2 3] P:0x2081ba150 L: 3 C: 6 S:[1 2 3] P:0x2081ba150 L: 4 C: 6 S:[1 2 3 90] P:0x2081ba150 L: 5 C: 6 S:[1 2 3 90 91] P:0x2081ba150 L: 6 C: 6 S:[1 2 3 90 91 92] P:0x2081c8000 L: 7 C:12 S:[1 2 3 90 91 92 93] P:0x2081c8000 L: 8 C:12 S:[1 2 3 90 91 92 93 94] P:0x2081c8000 L: 9 C:12 S:[1 2 3 90 91 92 93 94 95] P:0x2081c8000 L:10 C:12 S:[1 2 3 90 91 92 93 94 95 96] P:0x2081c8000 L:11 C:12 S:[1 2 3 90 91 92 93 94 95 96 97] P:0x2081c8000 L:12 C:12 S:[1 2 3 90 91 92 93 94 95 96 97 98] P:0x2081cd250 L:13 C:24 S:[1 2 3 90 91 92 93 94 95 96 97 98 99] [1 2 3 90 91 92] [1 2 3 90 91 92 93 94 95 96 97 98 99] ``` Notice a few things. * The original capacity of our slice matches the original size of our array. * The location in memory of the values of our slice stays the same until the slice's length exceeds the slice's capacity. At this point, under the hood, Go allocates a new array acciated with a larger contiguous block of memory. The slice's capacity is doubled. Subsequent append calls won't require new memory allocation until the capacity is again exceed (the last append call also exceeds capacity) * The first 3 append calls overwrote the final 3 elements of our original array variable! So be careful when working with both arrays and slices. You may be better off just working with slices. Consider this, the call ```slcA[0]=-5``` will a have different effect depending of where we call it. If we call it before the for loop, when our array and our slice are sharing memory, ... ### to do - [x] if-else statements - [x] switch statements -
honkskillet revised this gist
Jan 31, 2015 . 1 changed file with 7 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -601,20 +601,20 @@ There is also closure in go! In Go, functions are first class which means we ca ```go func Mycounter() func(){ theCount:= 0 increment := func(){ theCount++ fmt.Println("The count is", theCount) } return increment } ``` It's important to note that the scope of the ```increment``` function is the scope of the function that it is decalred within. That is to say, the variabel ```theCount``` is within the scope of the function ```increment```. That means that even after Mycounter() returns, ```theCount``` variable will resist in ```increment```'s closure. We can use this as follows. ```go func main(){ var incFunc func() incFunc = MyCounter() for i:=0; i<5; i++{ incFunc() //use () to execute increment } } ``` @@ -626,20 +626,19 @@ The count is 3 The count is 4 The count is 5 ``` Of course in Go we can also return multiple value, including multiple func variables. Let's impliment a getter funtion for our count variable. This function will take no parameters and return an int, thus it's *type* will be ```func() int```. Note that this is a completely different type than our increment func variable, which had a type of ```func()```. (Let's also add a paramater to Mycounter so we can set our counters initial value.) ``` func Mycounter(initialCount int) ( func(), func() int){ theCount:= initialCount increment := func(){ theCount++ fmt.Println("The count is", theCount) } get := func() int{ fmt.Println("The count is", theCount) return theCount } return increment, get } ``` This could be used as follows... -
honkskillet revised this gist
Jan 31, 2015 . 1 changed file with 8 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -599,8 +599,8 @@ alt="YOUTUBE VIDEO TUTORIAL" border="5" bordercolor="#ff0000" /></a> There is also closure in go! In Go, functions are first class which means we can have function types, pass fuctions as parameters and return functions to and from functions and methods, and have closure. Lets define a counter function that returns a function. The function that it returns will inciment a count variable, ```theCount```. ```theCount``` will take no parameters and return no value itself. ```go func Mycounter() func(){ theCount:= 0 incriment := func(){ theCount++ fmt.Println("The count is", theCount) @@ -611,10 +611,10 @@ func Mycounter(initialCount int) func(){ It's important to note that the scope of the ```incriment``` function is the scope of the function that it is decalred within. That is to say, the variabel ```theCount``` is within the scope of the function ```incriment```. That means that even after Mycounter() returns, ```theCount``` variable will resist in ```incriment```'s closure. We can use this as follows. ```go func main(){ var incFunc func() incFunc = MyCounter() for i:=0; i<5; i++{ incFunc() //use () to exicute incriment } } ``` @@ -645,11 +645,11 @@ func Mycounter(initialCount int) ( func(), func() int){ This could be used as follows... ```go func main(){ incFunc, getFunc := Mycounter(10) for i:=0; i<5; i++{ incFunc() } fmt.Println("The final value is ", getFunc()) } ``` ... yielding this output. -
honkskillet revised this gist
Jan 31, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -505,7 +505,7 @@ func (ms myStruct) addByValue(x int) { ///it is OK to leave the return type off fmt.Println("ByValue internal value ", ms.intField) } func (ms *myStruct) addByReference(x int) { ms.intField+=x fmt.Println("ByReference internal value ", ms.intField) } -
honkskillet revised this gist
Jan 31, 2015 . 1 changed file with 5 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -692,18 +692,17 @@ Array declaration syntax is straight forward. We have to decalre both the value arrB := [5]int {3,4,5,6,7} arrC := [...]int {4,5,6,7,8} ``` I repeat, the type of an array consists of both it's length And it's element type. This won't work.... ```go arrA := [5]int {1,2,3,4,5} arrB := [4]int {4,5,6,7} arrA=arrB //// ERROR! arrA and arrB variables of different types, specifically [5]int and [4]int respectively ``` The other crucial thing about Go arrays is that an array is a value, not a pointer. In C, an array is a pointer to block of memory. Not so in Go. If you set a Go array ```arrA``` equal to another Go array ```arrB```, the two arrays will represent values in two completely differnt blocks of memory. Any subsequent changes to arrA will have no effect on arrB. ```go func main(){ var arrA [5]int var arrB = [5]int {3,4,5,6,7} arrA=arrB //the values of arrB are copied into the memory of arrA arrA[2]=15 //arrB will be uneffected fmt.Println(arrA,arrB) @@ -721,7 +720,7 @@ This yields the following output. Notice changes to one array do not effect the - [x] if-else statements - [x] switch statements - [x] structs - [x] arrays - [ ] slices - [ ] maps - [ ] defers -
honkskillet revised this gist
Jan 31, 2015 . 1 changed file with 19 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -15,6 +15,7 @@ by alexander white © - [10 - methods](https://gist.github.com/honkskillet/bd1f72223dd8e06b5ce6#golang-10---methods) - [11 - interfaces](https://gist.github.com/honkskillet/bd1f72223dd8e06b5ce6#golang-11---interfaces) - [12 - closure](https://gist.github.com/honkskillet/bd1f72223dd8e06b5ce6#golang-12---closure) - [13 - arrays](https://gist.github.com/honkskillet/bd1f72223dd8e06b5ce6#golang-13---arrays) Youtube: [link to playlist](https://www.youtube.com/playlist?list=PLB-tlgQ97VrdH1qcBKTghZQ09Qy5P1g2K&spfreload=10) @@ -697,6 +698,24 @@ I repeat, the type of an array consists of both it's length and it's element typ arrB := [4]int {4,5,6,7} arrA=arrB //// ERROR! arrA and arrB variables of different types, namely [5]int and [4]int respectively ``` The other curial opint about Go arrays is that arrays are a value, not a pointer. In C, an array is a pointer to block of memory. Not so in Go. If you set a Go array ```arrA``` equal to another Go array ```arrB```, the two arrays will represent values in two complete differnt blocks of memory. Any subsequent changes to arrA will have no effect on arrB. ```go func main(){ var arrA [5]int var arrB = [...]int {3,4,5,6,7} //var arrB[6]int arrA=arrB //the values of arrB are copied into the memory of arrA arrA[2]=15 //arrB will be uneffected fmt.Println(arrA,arrB) fmt.Printf("%p \n%p\n",&arrA,&arrB) //%p is formatting for a point, dereference arrA with & to get a pointer } ``` This yields the following output. Notice changes to one array do not effect the other and the arrays occupy different locations in memory. ``` [3 4 15 6 7] [3 4 5 6 7] 0x2081ba150 0x2081ba180 ``` ### to do - [x] if-else statements -
honkskillet revised this gist
Jan 30, 2015 . 1 changed file with 19 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -679,6 +679,25 @@ func (m myStruct) uglyMethod(paramA int, paramB, paramC) ( firstFuncType, second ``` That is a little more readable, in particular if we end up reusing those new types multiple times in our code. ### golang 13 - arrays <a href="http://www.youtube.com/watch?feature=player_embedded&v=WUdMrIIzdAE " target="_blank"><img src="http://img.youtube.com/vi/WUdMrIIzdAE/mqdefault.jpg" alt="YOUTUBE VIDEO TUTORIAL" border="5" bordercolor="#ff0000" /></a> Array declaration syntax is straight forward. We have to decalre both the value of the elements of the array AND the length. All the declaration below declare arrays of type [5]int. Note, for arrC, Go will infer the length of the array if we use ```[...]``` during assignment. ```go var arrEmpty [5]int var arrA = [5]int {1,2,3,4,5} arrB := [5]int {3,4,5,6,7} arrC := [...]int {4,5,6,7,8} ``` I repeat, the type of an array consists of both it's length and it's element type. This won't work. ```go arrA := [5]int {1,2,3,4,5} arrB := [4]int {4,5,6,7} arrA=arrB //// ERROR! arrA and arrB variables of different types, namely [5]int and [4]int respectively ``` ### to do - [x] if-else statements - [x] switch statements -
honkskillet revised this gist
Jan 28, 2015 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -592,8 +592,8 @@ Without interfaces the type system in Go would be extremely constrictive. ### golang 12 - closure <a href="http://www.youtube.com/watch?feature=player_embedded&v=QE5QjR0CZVM " target="_blank"><img src="http://img.youtube.com/vi/QE5QjR0CZVM/mqdefault.jpg" alt="YOUTUBE VIDEO TUTORIAL" border="5" bordercolor="#ff0000" /></a> There is also closure in go! In Go, functions are first class which means we can have function types, pass fuctions as parameters and return functions to and from functions and methods, and have closure. Lets define a counter function that returns a function. The function that it returns will inciment a count variable, ```theCount```. ```theCount``` will take no parameters and return no value itself. -
honkskillet revised this gist
Jan 27, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -708,6 +708,6 @@ That is a little more readable, in particular if we end up reusing those new typ - [Go by example](https://gobyexample.com) - [golang docs](http://golang.org/doc/) - [golang weekls](http://golangweekly.com) - [closure and first class function code walk](http://golang.org/doc/codewalk/functions/) © All rights reserved by Alexander White. -
honkskillet revised this gist
Jan 27, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -708,6 +708,6 @@ That is a little more readable, in particular if we end up reusing those new typ - [Go by example](https://gobyexample.com) - [golang docs](http://golang.org/doc/) - [golang weekls](http://golangweekly.com) - [closure and first class variable code walk](http://golang.org/doc/codewalk/functions/) © All rights reserved by Alexander White. -
honkskillet revised this gist
Jan 27, 2015 . 1 changed file with 7 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -596,7 +596,7 @@ Without interfaces the type system in Go would be extremely constrictive. " target="_blank"><img src="http://img.youtube.com/vi/z3Uo8XiTjkU/mqdefault.jpg" alt="YOUTUBE VIDEO TUTORIAL" border="5" bordercolor="#ff0000" /></a> There is also closure in go! In Go, functions are first class which means we can have function types, pass fuctions as parameters and return functions to and from functions and methods, and have closure. Lets define a counter function that returns a function. The function that it returns will inciment a count variable, ```theCount```. ```theCount``` will take no parameters and return no value itself. ```go func Mycounter(initialCount int) func(){ theCount:= initialCount @@ -607,7 +607,7 @@ func Mycounter(initialCount int) func(){ return incriment } ``` It's important to note that the scope of the ```incriment``` function is the scope of the function that it is decalred within. That is to say, the variabel ```theCount``` is within the scope of the function ```incriment```. That means that even after Mycounter() returns, ```theCount``` variable will resist in ```incriment```'s closure. We can use this as follows. ```go func main(){ var incriment func() @@ -625,7 +625,7 @@ The count is 3 The count is 4 The count is 5 ``` Of course in Go we can also return multiple value, including multiple func variables. Let's impliment a getter funtion for our count variable. This function will take no parameters and return an int, thus it's *type* will be ```func() int```. Note that this is a completely different type than our incriment func variable, which had a type of ```func()```. (Let's also add a paramater to Mycounter so we can set our counters initial value.) ``` func Mycounter(initialCount int) ( func(), func() int){ theCount:= initialCount @@ -671,9 +671,9 @@ func (m myStruct) uglyMethod(paramA, paramB, paramC int) ( func(pA,pB) float, fu ``` That's getting a little dense. To clarify thing we could could declare some new function types. ```go type firstFuncType func(pA,pB) float type secondFuncType func(p1, p2, p3) int func (m myStruct) uglyMethod(paramA int, paramB, paramC) ( firstFuncType, secondFuncType ){ .... } ``` @@ -708,5 +708,6 @@ That is a little more readable, in particular if we end up reusing those new typ - [Go by example](https://gobyexample.com) - [golang docs](http://golang.org/doc/) - [golang weekls](http://golangweekly.com) - [closure and first class variable code wal](http://golang.org/doc/codewalk/functions/) © All rights reserved by Alexander White. -
honkskillet revised this gist
Jan 27, 2015 . 1 changed file with 83 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -596,6 +596,89 @@ Without interfaces the type system in Go would be extremely constrictive. " target="_blank"><img src="http://img.youtube.com/vi/z3Uo8XiTjkU/mqdefault.jpg" alt="YOUTUBE VIDEO TUTORIAL" border="5" bordercolor="#ff0000" /></a> There is also closure in go! In Go, functions are first class which means we can have function type, pass fuctions as parameters and return functions to and from functions and methods, and have closure. Lets define a counter function that returns a function. The function that it returns will inciment a count variable, ```theCount```. It will take no parameters and return no value itself. ```go func Mycounter(initialCount int) func(){ theCount:= initialCount incriment := func(){ theCount++ fmt.Println("The count is", theCount) } return incriment } ``` It's important to note that the scope of the ```incriment``` a func type is the scope of the function that it is decalred within. That is to say, the variabel ```theCount``` is within the scope of the function ```incriment```. That means that even after Mycounter() returns, ```theCount``` variable will resist in ```incriment```'s closure. We can use this a follows. ```go func main(){ var incriment func() incriment = MyCounter() for i:=0; i<5; i++{ incriment() //use () to exicute incriment } } ``` This will give the following output. ``` The count is 1 The count is 2 The count is 3 The count is 4 The count is 5 ``` Of course in go we can also return multiple value, including multiple func variables. Let's impliment a getter funtion for our count variable. This function will take no parameters and return an int, thus it's *type* will be ```func() int```. Not that this is a completely different type than our incriment func variable, which had a type of ```func()```. (Let's also add a paramater to Mycounter so we can set our counters initial value.) ``` func Mycounter(initialCount int) ( func(), func() int){ theCount:= initialCount incriment := func(){ theCount++ fmt.Println("The count is", theCount) } get := func() int{ fmt.Println("The count is", theCount) return theCount } return incriment, get } ``` This could be used as follows... ```go func main(){ incriment, get := Mycounter(10) for i:=0; i<5; i++{ incriment() } fmt.Println("The final value is ", get()) } ``` ... yielding this output. ``` The count is 11 The count is 12 The count is 13 The count is 14 The count is 15 The count is 15 The final value is 15 ``` Notice that incriment and get functions share the same theCount value. It persists encapsulated in Closureland! Lastly, the declaration for our Mycounter function is starting to get a little long and ugly. Of course, it could get even worse too. Let imagine a method declaration, ```go func (m myStruct) uglyMethod(paramA, paramB, paramC int) ( func(pA,pB) float, func(p1, p2, p3) int){ .... } ``` That's getting a little dense. To clarify thing we could could declare some new function types. ```go type firstFunc func(pA,pB) float type secondFunc func(p1, p2, p3) int func (m myStruct) uglyMethod(paramA int, paramB, paramC) ( firstFunc, secondFunc ){ .... } ``` That is a little more readable, in particular if we end up reusing those new types multiple times in our code. ### to do - [x] if-else statements - [x] switch statements -
honkskillet revised this gist
Jan 27, 2015 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -561,7 +561,7 @@ func main(){ myCar.cost = 10000.0 bool starts = myCar.canStart() //this works, variable of type kid can access parent fields and methods var genericCar car genericCar = myCar //ERROR! this does not work, embedding a type does not yield OO inheritance } ``` @@ -588,7 +588,7 @@ func main(){ } ``` Without interfaces the type system in Go would be extremely constrictive. ### golang 12 - closure -
honkskillet revised this gist
Jan 27, 2015 . 1 changed file with 49 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -541,6 +541,55 @@ func main(){ " target="_blank"><img src="http://img.youtube.com/vi/Ijp8vd85sYI/mqdefault.jpg" alt="YOUTUBE VIDEO TUTORIAL" border="5" bordercolor="#ff0000" /></a> Go isn't a traditionally Object Oriented language, and thus lacks the feature of inheritance. Specifically, a struct (the "child") that embeds another struct (the "parent") cannot be set to or passed as a variable of the type parent. For example, ```go struct car type{ cost float } func (c car) canStart() bool{ return true } struct delorian type{ car //embed the car struct coolnessFactor int } func main(){ var myCar delorian myCar.cost = 10000.0 bool starts = myCar.canStart() //this works, variable of type kid can access parent fields and methods var genericCar car genericCar = myCar //this does not work, embedding a type does not yield OO inheritance } ``` Instead, Go provide for a feuture call ```interfaces```. An interface is a type. An interface is a *type*. Interface... **type**. An interface is a **type** that declares itself as being able to handles a set of methods. Interfaces do not pertain to fields at all (unlike OO objects which define a set of methods AND properties). So if we were to refactor the above code for interfaces, we would get... ```go struct car interface{ canStart() bool{ } struct delorian type{ coolnessFactor int } func (d delorian) canStart() bool{ return false } func main(){ var myCar delorian myCar.cost = 10000.0 bool starts = myCar.canStart() //this works, variable of type kid can access parent fields and methods var genericCar car genericCar = myCar //this works. delorian impliments the method canStart so it satisfies the conditions required to be type car } ``` ### golang 12 - closure <a href="http://www.youtube.com/watch?feature=player_embedded&v=z3Uo8XiTjkU -
honkskillet revised this gist
Jan 27, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -558,7 +558,7 @@ alt="YOUTUBE VIDEO TUTORIAL" border="5" bordercolor="#ff0000" /></a> - [x] methods - [x] interfaces - [ ] errors - [x] closure - [ ] variadic functions - [ ] go routines - [ ] channels -
honkskillet revised this gist
Jan 27, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -556,7 +556,7 @@ alt="YOUTUBE VIDEO TUTORIAL" border="5" bordercolor="#ff0000" /></a> - [ ] maps - [ ] defers - [x] methods - [x] interfaces - [ ] errors - [ ] closure - [ ] variadic functions -
honkskillet revised this gist
Jan 27, 2015 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -13,7 +13,7 @@ by alexander white © - [8 - structs](https://gist.github.com/honkskillet/bd1f72223dd8e06b5ce6#golang-8---structs) - [9 - moar structs](https://gist.github.com/honkskillet/bd1f72223dd8e06b5ce6#golang-9---moar-structs) - [10 - methods](https://gist.github.com/honkskillet/bd1f72223dd8e06b5ce6#golang-10---methods) - [11 - interfaces](https://gist.github.com/honkskillet/bd1f72223dd8e06b5ce6#golang-11---interfaces) - [12 - closure](https://gist.github.com/honkskillet/bd1f72223dd8e06b5ce6#golang-12---closure) Youtube: [link to playlist](https://www.youtube.com/playlist?list=PLB-tlgQ97VrdH1qcBKTghZQ09Qy5P1g2K&spfreload=10) @@ -536,7 +536,7 @@ func main(){ } ``` ### golang 11 - interfaces <a href="http://www.youtube.com/watch?feature=player_embedded&v=Ijp8vd85sYI " target="_blank"><img src="http://img.youtube.com/vi/Ijp8vd85sYI/mqdefault.jpg" alt="YOUTUBE VIDEO TUTORIAL" border="5" bordercolor="#ff0000" /></a>
NewerOlder