Sorting cant understand debugg error


#1

def alphabetize(arr,rev =false)
arr.sort!
puts numbers
end
numbers = [5, 1, 3, 8]
def(numbers)

gives me :
(ruby):5: syntax error, unexpected '\n', expecting tCOLON2 or '.'


#3

Hi Reury,

Line 6 is causing the problem. Replace it with puts alphabetize(numbers), and you'll get passed :)


#4

i dont get how ruby works but it seem to me array r pointers ? so wouldnt passing a vector as argument modify numbers and also couldnt quite understand why mine didnt work


#5

def numbers defines a function in Ruby, so you needed to have your function do something, then end. Since you didn't have it like that, it caused a syntax error.


#6

It gave me an error, but it let me pass :confused:


#7

@falconheavy Please create a new topic, and someone will help you over there :slightly_smiling:


#8