[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Negative Numbers

Berger, Daniel

7/13/2006 4:22:00 PM

> -----Original Message-----
> From: list-bounce@example.com
> [mailto:list-bounce@example.com] On Behalf Of Marston A.
> Sent: Thursday, July 13, 2006 10:20 AM
> To: ruby-talk ML
> Subject: Negative Numbers
>
>
> 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.

Use the .abs method

irb(main):001:0> -7.abs
=> 7

Regards,

Dan


This communication is the property of Qwest and may contain confidential or
privileged information. Unauthorized use of this communication is strictly
prohibited and may be unlawful. If you have received this communication
in error, please immediately notify the sender by reply e-mail and destroy
all copies of the communication and any attachments.