Choose Category
func main() { var student = Student{} student.name = "Ram" student.age = 10 student.printName() } type Student struct { name string age int } func (student Student) printName() { // Method on struct type print(student.name) } func printName(student Student) { // Method which takes struct as parameter print(student.name) }