map

command
v0.0.0-...-280f8e7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 19, 2024 License: CC0-1.0 Imports: 1 Imported by: 0

README

Maps

package main

import "fmt"

func main() {
	//declarando um map
	var m = map[string]int{"Arroz": 1, "Feijão": 2}
	fmt.Println(m)

	//declarando map com make
	m1 := make(map[string]int)

	m1["Arroz"] = 1
	m1["Feijão"] = 2

	fmt.Println(m1)

	//verificar tamanho de um map
	fmt.Println(len(m1))

	//deletando elemento de um map
	delete(m1, "Feijão")
	fmt.Println(m1)
}

Playground

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL