Created
May 24, 2020 16:31
-
-
Save alfianmalik/30410b21aaf3c0e525cc23ba102a0465 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package people | |
// Declares a variable of type 'Person'. The internal fields of the p variable | |
// are set to their zero value i.e. FirstName is an empty string and Age is 0 | |
var p Person | |
// Instantiate a struct by supplying the value of all the struct fields. | |
var p = Person{"Joe", "Sweeny", 36} | |
// Initialize a struct by supplying name: value pairs of all the struct fields. | |
var p = Person{FirstName: "Joe", LastName: "Sweeny", Age: 36} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment