Git Product home page Git Product logo

Comments (7)

diegoparra avatar diegoparra commented on August 20, 2024

continuo apanhando de como atribuir os valores pro map kkkkk.

https://play.golang.org/p/_e4g3pQLBQM

from aprendago.

ph-py avatar ph-py commented on August 20, 2024

Foi de boa

https://play.golang.org/p/RnQCBb42DAa

from aprendago.

an4kein avatar an4kein commented on August 20, 2024

https://play.golang.org/p/ytGGXUhjLkQ

  • Crie e use um struct anônimo.
  • Desafio: dentro do struct tenha um valor de tipo map e outro do tipo slice.

Entendi que era para criar um struct anon e seus valores era para ser definido sem atribuir em uma variavel...

package main

import (
	"fmt"
)

func main() {

	anon := struct {
		nome  map[string]string
		valor []int
	}{
		map[string]string{"hello": "string"},
		[]int{1, 2, 3, 4, 5},
	}

	fmt.Println(anon)

}

Output

{map[hello:string] [1 2 3 4 5]}

Program exited.

ref: https://stackoverflow.com/questions/33903020/initializing-a-field-inside-an-anonymous-struct

from aprendago.

alansantosmg avatar alansantosmg commented on August 20, 2024

Minha solução:

func main() {

	alan := struct {
		telefone map[string]int
		idiomas  []string
	}{
		telefone: map[string]int{
			"celular":     22222222,
			"residencial": 333333},
		idiomas: []string{"ingles", "portugues"},
	}

	fmt.Println(alan)

}

from aprendago.

viniciussanchez avatar viniciussanchez commented on August 20, 2024

https://go.dev/play/p/rud95tGxxZP

from aprendago.

wfrsilva avatar wfrsilva commented on August 20, 2024

Cap. 11 – Exercícios: Nível #5 – 4
https://go.dev/play/p/bUz_N7CwINo

image

from aprendago.

Harsgaard avatar Harsgaard commented on August 20, 2024

https://go.dev/play/p/9cnEeOw1f5w

from aprendago.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.