```On 2007-10-30 18:41:01 +0100, Sebastian Probst Eide
<sebastian.probst.eide / gmail.com> said:

> Couldn't you write something like this?
>
> def	get_zl(origin)
> 	temp_val = farthest_proposition.distance_to(origin)
>    	[{:value=>1.0, :zl=>14}, {:value=>2.0, :zl=>13},  {:value=>5.0,
> :zl=>12}, {:value=>10.0, :zl=>11},  {:value=>15.0, :zl=>10},
> {:value=>25.0, :zl=>9}].each {|pair| return  pair[:zl] if temp_val <=
> pair[:value]}
> end
>
> Maybe it is not the smartest way to solve the problem, but it is a
> different solution none the less. Hope it helps and let's you find  the
> ultimate solution yourself!
> I didn't replace it with one line as you requested, but with four...
>
>
> Best regards
> Sebastian
>
> On 30. okt. 2007, at 13.50, Josselin wrote:
>
>> I have a group of lines  (used in Googlemaps display)  based on 2  arrays :
>>
>> zl = 9 if farthest_proposition.distance_to(origin) < = 25.0
>> zl = 10 if farthest_proposition.distance_to(origin) <= 15.0
>> zl = 11 if farthest_proposition.distance_to(origin) <= 10.0
>> zl = 12 if farthest_proposition.distance_to(origin) <= 5.0
>> zl = 13 if farthest_proposition.distance_to(origin) < =2.0
>> zl = 14 if farthest_proposition.distance_to(origin) <= 1.0
>>
>> how could I replace it the dryest way possible ?
>>
>> zl = [9, 10, 11, 12, 13, 14]
>> distance = [1.0, 2.0, 5.0, 10.0, 15.0, 25.0]
>> farthest_proposition.distance_to(origin) is never > 25 (eliminated  before..)
>> farthest_proposition.distance_to(origin)  can be 0.0, never negative
>>
>> thanks for yoru suggestions...
>>
>> joss

thanks a lot..  when trying to get DRY,  I just wonder if it helps in
performance ..
in both cases we perform 6 IF..

```