Am Montag 22 Juni 2009 03:50:31 schrieb Zorigami: > [I wrote:] > > "$%.2f" % @price > > > > Note though that for accuracy reason it's best to store currency as an > > int of > > cents, not a float of dollars so then it would look like this: > > "$%d.%02d" % @price.divmod(100) > > Sorry, I'm a beginner at Ruby(Not at programming though...) > Could you show me that in the method? > Thanks. In both cases you can turn the snippet into a method by putting "def foo()" in front of it and "end" behind it. That's all there is to it. HTH, Sebastian