A simple map program in Golang on how to use it properly.
My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.
My mobile number here in the Philippines is 09173084360.
My telephone number at home here in Bacolod City, Negros Occidental Philippines is +63 (034) 4335675.
Here in Bacolod I also accepting computer repair, networking and Arduino Project development at a very affordable price.
My personal website is http://www.jakerpomperada.com.
Program Listing
package main
import "fmt"
func main() {
grades := make(map[string]float32)
grades["john"] = 42
grades["peter"] = 55
grades["luke"] = 45
fmt.Println(grades)
JohnGrade := grades["john"]
fmt.Println(JohnGrade)
delete(grades,"john")
fmt.Println(grades)
grades["john"] = 55
grades["john"] = 65
for k,v := range grades {
fmt.Println(k,v)
}
// remove var if using :=
ages := make(map[string]float32) // need to do make since its nil
ages["jude"] = 10
fmt.Println(ages)
}
No comments:
Post a Comment