package
0.0.0-20240205144839-01d63041f4bf
Repository: https://github.com/fletchnj/learninggo-2e.git
Documentation: pkg.go.dev

# README

Exercise 3

Question

Write a program that defines a struct called Employee with three fields: firstName, lastName, and id. The first two fields are of type string and the last field (id) is of type int. Create three instances of this struct using whatever values you'd like. Initialize the first one using the struct literal style without keys, the second using the struct literal style with keys, and the third with var declaration. Use dot notation to populate the fields in the third struct. Print out all three structs.

Solution

This exercise covers defining a struct and initializing it. The struct literals with and without keys are interchangeable, but using keys is more maintainable and readable.