Kodewick
Commencer à apprendre →
Débutant←→0 / 70

Un nouveau héros

#049Débutanttype Hero struct2 min

Un nouveau héros rejoint le jeu. h est un Hero vide : mets son Name à "Pip" et son Level à 3, et la ligne en dessous affichera Pip Lv.3.

Devrait afficher
Pip Lv.3
main.go
package main

import "fmt"

type Hero struct {
	Name  string
	Level int
}

func main() {
	var h Hero
	// ton code ici: remplis h.Name et h.Level
	fmt.Printf("%s Lv.%d\n", h.Name, h.Level)
}
Ctrl + Entrée lance aussi le code
Résultat

Exécuter teste les exemples. Quand ils sont bons, appuie sur Envoyer.