Saturday, May 18, 2024
HomeGolangAjuda com preenchimento de valores em um array slice - Getting Assist

Ajuda com preenchimento de valores em um array slice – Getting Assist


Boa tarde pessoal, tudo bem com vocês? Espero que sim!
Trabalho com Observabilidade ( Zabbix, Grafana, Prometheus ), e sou um bashista nato hehehe.
Estou aprendendo GoLang há aproximadamente 1 semana, gostaria de entender por que isso não funciona Go Playground – The Go Programming Language

Basicamente minha idéia foi fazer um loop for, que preencheria os elementos do array.

Olá e bem-vindo.
Por que o playground não funciona para você? Você pode postar o código que está tentando executar? e o outro publica suas mensagens em inglês para que possam ter mais ajuda…

saudações

bundle principal

import “fmt”

func principal() {
var dilan string

for x := 0; x <= 10; x++ {
	if x != 10 {
		dilan += fmt.Sprintf("%v,", x)
	} else {
		dilan += fmt.Sprintf("%v", x)
	}
}

slice := []string{dilan}
fmt.Println(slice[0])

}

Thanks for the recommendation, Yamil_Bracho.

It appears it’s working…Its shops all of the string in a slice of 1 ingredient…

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments