Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Impara Sfida: Creazione di una Struttura | Introduzione a Struct e Map
Introduzione a Golang

bookSfida: Creazione di una Struttura

Compito

Creare una struttura denominata Car con i campi company, owner, miles e year nello stesso ordine. Assegnare i tipi di dato appropriati in base al codice fornito.

index.go

index.go

copy
12345678910111213141516
package main import "fmt" // Write code below this line // Write code above this line func main() { var car1 Car car1.company = "Tesla" car1.owner = "Tegmark" car1.miles = 10.7 car1.year = 2021 fmt.Println(car1) }
question mark

Qual è il tipo di dato assegnato al campo miles nella struttura Car?

Select the correct answer

Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 6. Capitolo 8

Chieda ad AI

expand

Chieda ad AI

ChatGPT

Chieda pure quello che desidera o provi una delle domande suggerite per iniziare la nostra conversazione

Suggested prompts:

What data types should I use for each field in the Car structure?

Can you explain why these specific data types are chosen for each field?

Can you show how to create and initialize a Car variable?

Awesome!

Completion rate improved to 1.96

bookSfida: Creazione di una Struttura

Scorri per mostrare il menu

Compito

Creare una struttura denominata Car con i campi company, owner, miles e year nello stesso ordine. Assegnare i tipi di dato appropriati in base al codice fornito.

index.go

index.go

copy
12345678910111213141516
package main import "fmt" // Write code below this line // Write code above this line func main() { var car1 Car car1.company = "Tesla" car1.owner = "Tegmark" car1.miles = 10.7 car1.year = 2021 fmt.Println(car1) }
question mark

Qual è il tipo di dato assegnato al campo miles nella struttura Car?

Select the correct answer

Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 6. Capitolo 8
some-alt