From: Bertram Scharpf Date: 2006-07-14T05:12:30+09:00 Subject: Re: Negative Numbers Hi, just another comment: Am Freitag, 14. Jul 2006, 01:22:56 +0900 schrieb Justin Collins: > Marston A. wrote: > >I'm just getting started with Ruby and was wondering if there is a way > >to translate negative numbers into their positive equals. i.e turning > >-7 into 7. Thanks for any help. > > irb(main):001:0> -7.abs > => 7 Be careful. The minus sign is part of the constant. A minus prepended to a variable takes precedence over the `abs' function call: irb(main):001:0> -7.abs => 7 irb(main):002:0> a=7 ; -a.abs => -7 Bertram -- Bertram Scharpf Stuttgart, Deutschland/Germany http://www.bertram-scharpf.de