From the course: Go Essentials: Concurrency, Connectivity, and High-Performance Apps

Unlock the full course today

Join today to access over 24,400 courses taught by industry experts.

Challenge: Structs

Challenge: Structs

(exciting music) - [Instructor] Define a square structure. It should have three fields, X and a Y, which are integers, and a length, which is also an integer. Create a new function to create a new square and add two methods. One, Move, which will move the square by Delta X and Delta Y, and an area that will return the area of the square. In the main, you should be able to create a new square with new square. Move it to a new location. You can print it out and also print out the area.

Contents