Comparing similar structs

Report a typo

Professor Ross Geller has been learning about Go structures and has created a program to help him classify chemical elements with the Element struct. It contains the Name, Symbol, and AtomicNumber fields.

By accident, Professor Geller has created one too many sodium structs of the Element type! Some of these structs are missing values on their fields. Can you help Ross identify and select which one of these structs is equal to the original sodium struct? Below you will see the structs created within his program:

package main

type Element struct {
    Name         string
    Symbol       string
    AtomicNumber int
}

func main() {
   // below is the original 'sodium' struct
    sodium := Element{
        Name:         "Sodium",
        Symbol:       "Na",
        AtomicNumber: 11,
    }

    // below are the various copies of 'sodium' Professor Ross created!
    sodium1 := Element{Name: "Sodium", Symbol: "Na"}
    sodium2 := Element{Name: "Sodium", Symbol: "Na", AtomicNumber: 11}
    sodium3 := Element{Symbol: "Na", AtomicNumber: 11}  
}
Select one option from the list
___

Create a free account to access the full topic