I just created this code to experiment with type ,i will explain the problems later
My Code =
package main
import(
"fmt"
"math/rand"
"time"
)
type Games struct {
game string
creator string
}
func main(){
videogames := []Games{
{"inFamous","Sucker Punch Games"},
{"Halo","343 Games"},
{"JustCause","Eidos"},
}
rand.Seed(time.Now().UTC().UnixNano())
i := rand.Intn(len(videogames))
fmt.Print(videogames[i])
}
If I run this the result will be,
{inFamous,Sucker Punch Games}
Now what i want to do is separate the arrays so that the result will be,
Game = inFamous
Publisher = Sucker Punch Games
Also i need to remove the opening and closing brackets.
Any help is greatly appreciated.
Aucun commentaire:
Enregistrer un commentaire