Grokking Go
Vote

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:

  1. Accessing struct fields
  2. Modifying struct fields
  3. 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%


Vote for new content