Created
March 6, 2022 15:14
-
-
Save xvbnm48/e3f20d92d7d5e7345daf3eff2bbe4afc to your computer and use it in GitHub Desktop.
struct example in golang
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 main | |
import "fmt" | |
type Student struct { | |
ID string | |
Name string | |
Age int | |
Email string | |
} | |
func main(){ | |
student := Student{} | |
student.ID = "123" | |
student.Name = "sakura" | |
student.Age = 20 | |
student.Email = "[email protected]" | |
fmt.Println(student) | |
// hasilnya adalah | |
// {123 sakura 20 [email protected]} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment