Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

•Re: Re: Re: Re: Multi-Threaded Elevator Simulator

by merlyn (Sage)
on Aug 07, 2002 at 22:56 UTC ( [id://188480]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Re: Multi-Threaded Elevator Simulator
in thread Multi-Threaded Elevator Simulator

$max_wait = ($wait1 > $wait2) ? ($wait1 > $max_wait) ? $wait1 : $max +_wait : ($wait2 > $max_wait) ? $wait2 : $max_wait;
If I was your teacher, I'd rap you on the knuckles with a ruler for writing that! Gah!

Please, consider this much clearer alternative:

$max_wait < $_ and $max_wait = $_ for $wait1, $wait2;
Or, if you don't like the "and" there...
for ($wait1, $wait2) { $max_wait = $_ if $max_wait < $_; }

-- Randal L. Schwartz, Perl hacker

Replies are listed 'Best First'.
Re: &bull;Re: Re: Re: Re: Multi-Threaded Elevator Simulator
by BrentDax (Hermit) on Aug 09, 2002 at 22:29 UTC
    Personally, I've always been fond of (sort {$a<=>$b} ($wait1, $wait2))[-1]...

    =cut
    --Brent Dax
    There is no sig.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://188480]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (6)
As of 2024-03-29 05:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found