Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Leer Challenge: Creating a Structure | Intro to Structs & Maps
Introductie tot Golang

bookChallenge: Creating a Structure

Task

Create a structure named Car with fields company, owner, miles, and year in the same order. Assign appropriate data types to them based on the provided code.

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

What is the data type assigned to the miles field in the Car structure?

Select the correct answer

Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 6. Hoofdstuk 8

Vraag AI

expand

Vraag AI

ChatGPT

Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.

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?

How do I create and initialize a Car struct in Go?

Awesome!

Completion rate improved to 1.96

bookChallenge: Creating a Structure

Veeg om het menu te tonen

Task

Create a structure named Car with fields company, owner, miles, and year in the same order. Assign appropriate data types to them based on the provided code.

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

What is the data type assigned to the miles field in the Car structure?

Select the correct answer

Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 6. Hoofdstuk 8
some-alt