19/20 What is going on here?


#1

16%20AM
I’m assuming that I should probably stop putting ‘puts’ into the def, specifically when messing with integers.


#2

Let your method return the square and puts the return value.


#3

did you also call square(13) and square(20) ?

Your function probably should return n**2
Then puts square(2) outside the function


#4

This unit has a lesson on implicit return…

def square(n)
  n ** 2
end

puts square(25)    # 625

#5

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