Return values from function without using return statement
def perimeter_of_square(side_length)
side_length * 4
end
def area_of_square(side_length)
side_length * side_length
end
def perimeter_of_triangle(side1, side2, side3)
side1 + side2 + side3
end
def area_of_triangle(base_width, height)
base_width * height / 2
end
puts area_of_triangle(6,6)
puts perimeter_of_square(5)
Related examples in the same category