Advertisement
Guest User

Untitled

a guest
Apr 25th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. package main
  2.  
  3. import "fmt"
  4.  
  5. func main(){
  6. rating := map[string]float32 {"C":5,"Go":4.5,"Python":4.5,"C++":2}
  7. fmt.Println(rating)
  8. // console'dan verileri yazdırırken neden veritipini
  9. //yazıyor anlamıyorum.
  10. csharpRating, ok := rating["C#"]//her ikisine C# keyini mi atadı?
  11. fmt.Println(csharpRating)
  12. if ok {
  13. fmt.Println("C# is in the map and its rating is",csharpRating)
  14. } else {
  15. fmt.Println("We have no rating associated with c# in the map")
  16. }
  17. fmt.Println(rating)
  18. delete(rating,"C")
  19. fmt.Println(rating)
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement