
[Golang] Get To Know More About Struct On Golang
Struct is a collection of variables or functions that have various data types. in the go programming language, we can create new variables using structs. the use of structs is usually done to make it easier to call data.
Writing a struct begins with a type then continues with the name of the struct.

The employee structure consists of the name variable and also the age variable. The name variable has a string data type, while the age variable has an integer data type.

The employee variable is a filled struct. In the example above, the variable name in the employee struct is filled with Asdam in the form of a string. while the age variable is filled with the number 10 which is an integer.

We can also use the array data type in the struct property. so that we can add a lot of data in one property or struct variable.

In the example above, we add 1 skill variable in the form of an array

The code above displays the multivalue skill which is part of the employee struct with type data array.

In addition, writing data types on struct properties can also be obtained from other structs.

We add a department struct which contains the DepartmentName property with the string data type. And in the employee struct, we add the department obtained from the struct department.

In the code above, displays the employee department data where the data is obtained from different structs.

Finally, we already know about structs in the go programming language. after we know the struct we can apply the struct to the service we will create.