Z
Zorigami
[Note: parts of this message were removed to make it a legal post.]
I was wondering if anyone had any ideas on how I could make the following
method "return "$#{@price}0" if "@price" only has one 0 after the ".", and
just "return "$#{@price}" if it has two?
Thanks.
(The following method is inside a class called "Product"... Hence the
subject)
def price
if @price.to_s.length == 4
return "$#{@price}"
else @price.to_s.length
return "$#{@price}0"
end
end
I was wondering if anyone had any ideas on how I could make the following
method "return "$#{@price}0" if "@price" only has one 0 after the ".", and
just "return "$#{@price}" if it has two?
Thanks.
(The following method is inside a class called "Product"... Hence the
subject)
def price
if @price.to_s.length == 4
return "$#{@price}"
else @price.to_s.length
return "$#{@price}0"
end
end