Creating a new instance from other instances using Struct update syntax.
When a new instance uses most of the values of an old instance, then we can use the struct update syntax. Consider two employees employee1 and employee2.
The first way is declaring the employee2 instance without syntax update.
The second way is declaring the employee2 instance by using syntax update.
The syntax '..' specifies that the rest of the fields are not explicitly set and they have the same value as the fields in the given instance.
Let's see a simple example of Structure:
Area of a right angled triangle is 300
In the above example, the structure of a triangle is created, and it contains two variables, i.e., base and height of a right-angled triangle. The instance of a Triangle is created inside the main() method.