5. Parameters and arguments


#1


I am stuck here and this code isn't working;

def cubertino (8)
puts = n ** 8
end


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

Error code
Oops, try again. Make sure to call cubertino and pass it the number 8 as an argument.

What is the solution?


Replace this line with your code.


#2

Hello

(I am have not done Ruby before) - but doing python, I recognized the wording in the instructions -

If you look at the examples given in this lesson -

If a method takes arguments, we say it accepts or expects those arguments.
We might define a function, square, like so:

def square(n)
puts n ** 2
end

and call it like this:

square(12).

The solution would be -

def cubertino(n)
puts n ** 3
end
cubertino(8)

Hope that helps.


#3

yes it does and it works. Thanks.


#4

Awesome dude.
Good luck for the next lessons.


#5

Hello

If you feel that your answer was solved, do not forget to mark it as such.
It will help others who might have experienced the same problem you had.

Thanks


#6

Yes, have done so.
I would be glad to help others later as well.
For now I am a beginner without any programming experience and working on some fingergespitzengefuhl.
Thanks.


#7

Thanks. Try helping others now. With the lessons you do understand. I found that explaining it to others I actually learnt more. Found new challenges as well.
Good luck with the coding.


#8

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