From: Craig Kim Date: 2006-07-14T02:28:22+09:00 Subject: Re: Negative Numbers You can always multiply it by negative one (-1), e.g. irb(main):001:0> a = -7 => -7 irb(main):002:0> a *= -1 => 7 irb(main):003:0> a => 7 ----- Original Message ----- From: "Mat Schaffer" To: "ruby-talk ML" Sent: Thursday, July 13, 2006 12:32 PM Subject: Re: Negative Numbers > On Jul 13, 2006, at 12:19 PM, Marston A. wrote: >> Hey all, >> >> 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. > > > Or if you want to flip the sign, just prepend a '-': > > irb(main):001:0> --7 > => 7 > > -Mat > > >