Grokking Go
0% completed
Accessing and Modifying Fields
Accessing and Modifying Fields in a Struct in Go
Once a struct is created and initialized, we often need to retrieve (access) and update (modify) its fields. In Go, struct fields are accessed using the dot (.) operator.
In this lesson, we will cover:
- Accessing struct fields
- Modifying struct fields
- Using struct fields in functions
Accessing Struct Fields
Struct fields can be accessed using the dot (.) operator.
Syntax for Accessing Struct Fields
variableName.fieldName
- `variableName
.....
.....
.....
Like the course? Get enrolled and start learning!
Reading Progress
0%