class Point attr_accessor :x, :y def initialize(x, y) @x, @y = x, y end def ~ @x, @y = @y, @x end endp = Point.new(1, 3)~p# p.x is 3 and p.y is 1puts "(x, y) is (#{p.x}, #{p.y})"