Initialize a struct with new

Report a typo

Below you will see a Go program that has the Pokemon struct declaration. Your task is to initialize the pikachu struct of the Pokemon type using the built-in new() function.

Note that this task uses the reflect package to check if you initialized the pikachu struct using the new() function. However, don't be scared! To solve this task, you don't need to know how the reflect package works.
Write a program in Go
package main

import (
"fmt"
"reflect"
)

type Pokemon struct {
Name string
Number int
Level int
}

// Initialize the `pikachu` struct using the `new()` function below
func main() {
pikachu := ?

isCreatedWithNew(pikachu) // DO NOT delete this line!

// DO NOT delete the code lines below!
_ = fmt.Print; _ = reflect.Struct
}
___

Create a free account to access the full topic