Define a Go Struct for a User Profile
This challenge will test your understanding of Go's struct definition. You will create a struct to represent a user's profile, including common attributes like their name, age, and email address. Defining custom data types with structs is fundamental for organizing data in Go applications.
Problem Description
Your task is to define a Go struct named UserProfile. This struct should be capable of holding the following information about a user:
- FirstName: A string representing the user's first name.
- LastName: A string representing the user's last name.
- Age: An integer representing the user's age.
- Email: A string representing the user's email address.
- IsActive: A boolean indicating whether the user's account is currently active.
You do not need to write any functions to manipulate this struct, only to define it.
Examples
Example 1:
Input: (No direct input needed for struct definition, this illustrates the concept)
Consider a user with the following data:
- FirstName: "Alice"
- LastName: "Smith"
- Age: 30
- Email: "alice.smith@example.com"
- IsActive: true
Output: (Conceptual representation of the struct instance)
A UserProfile struct instance would be defined and potentially initialized with this data.
Explanation: The UserProfile struct would be designed to hold these five distinct pieces of information.
Constraints
- The struct must be named
UserProfile. - The field names must exactly match the names provided in the Problem Description (case-sensitive).
- The data types for each field must be appropriate (e.g., string for names, int for age, bool for active status).
Notes
This is a foundational exercise. Focus on correctly declaring the struct type and its fields with their respective types. You are not expected to write a main function or demonstrate instantiation or usage of the struct in this challenge.