1. Learn
  2. /
  3. Courses
  4. /
  5. Intermediate Julia

Exercise

Writing your own functions - structs

In this final exercise on structs, you are going to modify a pre-defined structure using a custom constructor.

You have been provided with a custom type to store the details of each employee at our company, and this a mutable struct so that the values within the instance can be modified. Our company only has one office in Sydney, so let's set the location field to Sydney by default when creating a new instance.

After this, you need to write a custom function to increment the age field when it is the birthday of an employee.

Instructions 1/2

undefined XP
    1
    2
  • Define a custom function Employee to automatically populate the location for our employees with Sydney.