3. Create Your Own


#1

I don't understand what to do.Can someone help me?


#2

Look back over the first two lessons.

You already know that to define a method you use the word 'def' followed by the name of the method (anything you want). In this case, 'greeting' seems appropriate.

Then on the next line you specify what the method should do. In this case that is displaying a greeting. You can use the command 'puts' followed by whatever greeting you want.

Finally, to end the method, you have to write 'end'.


#3

All you have to do is this-->:yum:
def greeting
_ (1..10).each { |i| puts i }_
end


#4

whoops i accidentally put in the _ remember to delete those if you use that code.:grin:


#5

this code seem to work for me just fine

def greeting
puts greeting

end