ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> ruby-talk
ruby-talk
Re: array of integers
by Thomas Adam other posts by this author
Oct 31 2006 5:19AM messages near this date
Re: array of integers | Ruby tools for managing static websites?
On Tue, Oct 31, 2006 at 10:15:35PM +0900, Brad Tilley wrote:
>  What is the best way to get determine the largest and smallest int in an 
>  array of ints? For example:
>  
>  x = [1,2,3,4]
>  
>  x.smallest should = 1
>  x.largest should = 4
>  
>  How is this done in Ruby?

[n6tadam@workstation fvwm]% irb
> > [1,2,3].max
=>  3
> > [1,2,3].min
=>  1

-- Thomas Adam

-- 
"Wanting to feel; to know what is real.  Living is a lie." -- Purpoise
Song, by The Monkees.

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved