Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/namkatcedrickjumtock/golang-challanges


https://github.com/namkatcedrickjumtock/golang-challanges

Last synced: 1 day ago
JSON representation

Awesome Lists containing this project

README

        

# golang-tutorials

## Arrays / Slices
````
var ages [3]int = [3]int {1, 2 , 40} // strongely styped
var ages = [3]int {1, 2 , 40} // typed infered
ages = [3]int{1, 2, 3} // short hand assignmnt

names[1] = 30

types like int, string applies for other types.
````

````
slices uses arrays under the hood

var score = []int{23 , 45 ,6}

newScores := append(score, 50) // doesn't append to the original slice but return a new slice of names

ftmt.printl(newScores) // print new score sith 50 added
ftmt.printl(score) // print original score
````
````
Slice Ranges

names := []String {'cedrick', 'Junior', 'prince', 'Prosper'}

rangeOne :=names[1:3]

ftmt.printl(rangeOne) // output junior and prince. starts at pos 1 but doesn't pos 3
````