Oops, try again. It looks like your syntax isn't quite right. Check the first exercise if you need help!


#1



I got some help and ended up with the code below, but when I ran it I got the message:(ruby):9: syntax error, unexpected ',', expecting ')'
alphabetize (numbers,true)
^

can you check this code:


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

numbers = [5,1,3,8]

alphabetize (numbers,true)
puts numbers.map(&:inspect).join(',')
alphabetize (numbers)
puts numbers.map(&:inspect).join(',')


#2

    end
    return arr
end

All that is really needed is to puts the return value

puts alphabetize(numbers)

#3

How come there is a return arr after the second to the last end? I mean, why return arr?


#4

It's an expected return value in the exercise. Without it the SCT will see None and squawk about it. This way the alphabetized list gets sent back.


#5

I'm sorry, could you please tell me what SCT is. Thank you.:slight_smile:


#6

Submisson Correctness Test, a short lesson checker program that comes with each exercise.


#7

thanks that cleared it up