shapes-using-functions example
Calculating the area and perimeter of circles, rectangles and triangles
using functions.
GitHub Webpage
OVERVIEW
This is pretty straight forward using functions.
You just call all the different functions,
// Get the shape properties
c1Area := circleArea(c1)
c1Perimeter := circlePerimeter(c1)
r1Area := rectangleArea(r1)
r1Perimeter := rectanglePerimeter(r1)
t1Area := triangleArea(t1)
t1Perimeter := trianglePerimeter(t1)
We will see, we can simplify this using an interface.
RUN
go run shapes-using-functions.go