In this article I want to share some concepts related to named and anonymous types in Go with an example exercise.
Let’s take a text that represents a drawing with rectangles inside and our objective is to count them. The input is a []string input and the rectangles are drawn using 3 characters:
Here are a few examples:
A simple input with 1 rectangle
A more complex input with 5 rectangles
Our objective is, given any of these inputs, to count all the rectangles.
#go #golang #anonymous