Challenge: 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
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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)
}
12345678910111213141516package 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) }
Oliko kaikki selvää?
Kiitos palautteestasi!
Osio 6. Luku 8
Kysy tekoälyä
Kysy mitä tahansa tai kokeile jotakin ehdotetuista kysymyksistä aloittaaksesi keskustelumme