Make sure you return the array at the end of your method

def alphabetize (arr, rev=false)
    arr.sort!
    if rev == true
        arr.reverse!
    end
    arr
end

On Tue, Nov 18, 2014 at 5:25 PM, Roelof Wobben <r.wobben / home.nl> wrote:

>  Hello,
>
> I do the codeacademy course and I have sort a array.
>
> So I have this :
>
> def alphabetize (arr, rev=false)
>     arr.sort!
>     if rev == true
>         arr.reverse!
>     end
> end
>
> array = [ "c", "b", "a"]
> puts alphabetize(array)
> array2 = [ 3,2,1]
> puts alphabetize(array2)
>
> but now I see this error message :
>
> *Oops, try again.* It looks like your method doesn't default to
> alphabetizing an array when it doesn't receive a second parameter.
>
> Roelof
>
>
>
>


-- 
George Drummond
Software Engineer

+44 (0)333 240 2222


[image: Rentify]
 6-8 Long Lane, London EC1A 9HF
 www.rentify.com