main.m341 chars12 lines
This function named calculate_area
takes in the shape of the geometrical figure as a string (e.g., 'rectangle', 'circle', 'triangle') as the first argument, and then a variable number of arguments depending on the shape. For a rectangle, it takes two side lengths, for a circle it takes the radius, and for a triangle it takes the base and height. It calculates and returns the respective area based on the shape and input parameters.
gistlibby LogSnag