3. Create Your Own


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


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'.


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


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


this code seem to work for me just fine

def greeting
puts greeting