Creating a Book structure

Report a typo

Emma has just got a new job as a library assistant. Since she knows how to code in Go, she wants to write a small program that has a Book structure with fields to store the Title, Author, and Pages of the books to organize the library better.

Can you help her create the Book struct with the previously mentioned fields? The Title and Author fields should be of the string type and the Pages fields should be of the int type.

Write a program in Go
package main

import "fmt"

const TotalPages = 310

// create the Book struct here with the Title, Author and Pages fields
type ? struct {
? ?
? ?
? ?
}

// DO NOT delete or modify the contents of the main function!
func main() {
theHobbit := Book {
Title: "The Hobbit",
Author: "J. R. R. Tolkien",
Pages: TotalPages,
}

fmt.Printf("%#v", theHobbit)
}
___

Create a free account to access the full topic