Skip to content

Instantly share code, notes, and snippets.

@kkchu791
Created October 27, 2015 00:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kkchu791/09eb9d37bb4715166cb2 to your computer and use it in GitHub Desktop.
Save kkchu791/09eb9d37bb4715166cb2 to your computer and use it in GitHub Desktop.
class Rectangle
attr_reader :width, :height
def initialize (width, height)
@width = width
@height = height
end
def area
area = width * height
end
def perimeter
perimeter = (width + height)*2
end
end
r = Rectangle.new(23.45, 34.67)
puts "Area is = #{r.area}"
puts "Perimeter is = #{r.perimeter}"
@kotp
Copy link

kotp commented Oct 27, 2015

oops.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment