Methods, Blocks & Sorting == I am lost!


I am really struggling with Methods, Blocks & Sorting for Practice Makes Perfect

Help a sister out!

Replace this line with your code.


Let's take a look at your greeter method.

def greeter(name) >>> 'A method called greeter that takes names as arguments.'
return name = "Jane" >>> 'Don't do this! The argument you give greeter is what the name will be

Let's refactor greeter to do what we want now.

def greeter(name)
"Hello #{name}!"

Use string interpolation to display the name you gave greeter. Return is implicit.

Let's put our method to work now.

Will output => "Hello Jane"

Hope this helps, I'm happy to get a bit more detailed if need be.


Thanks, but I am still stuck. Why is it asking me to define the method as welcome?


I believe if you just change the name of the greeter method to welcome
def welcome(name)


Very silly. A lot of these lessons and programming in general is going to be very specific attention to detail and instructions.
It can be a bit maddening, however it does get easier.

What is important for now is understanding the syntax. What is a method, a method arguement, etc etc.

I recommend 'Why's poignant guide'
It will teach you proper syntax in a fun way.



As fight_dragons (cool name btw) said you need to stick to method names also you forgot the comma in the Return "Hello , #{name}" :sweat_smile:


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.