Methods, Blocks, & Sorting 7/19


#1



https://www.codecademy.com/courses/ruby-beginner-en-ET4bU/1/3?curriculum_id=5059f8619189a5000201fbcb#


(First Post :smiley:!)

(I'm a twelve year old learning to code by the way)

I don't know what is wrong with my code! It comes up with the error, "Make sure your add method expects two arguments." How do I fix this?


def add
    return n + 1
end


add(2)


#2

1- You need to write two numbers as arguments to the add method, to be like this: :slight_smile:

def add(x, y)

end

2- To return the sum of those numbers, inside the method, you must write:

def add(x, y)
    return x + y
end

#3

Thank you! It worked! :smile:


#4

silvergamesmc I'm also 12 years old but I've been doing code for around 3 years