9. Create Your Own!


#1

Hi community!,

I was wondering if someone can explain to me why the following code:

def greeter
yield
end

phrase = Proc.new do puts"Hello there!"
end

puts greeter(&phrase)

The code is printing “Hello there!” as it should but underneath it is also printing the number 21 as well.

Where is this number coming from and what does it mean?

Thanks in advance!


#2

very likely caused by the underlying validation of codecademy, if i run the code outside codecademy it doesn’t display 21.

https://repl.it/@stetim94/PositiveInferiorGuanaco


#3

Thanks, I wasn’t sure if that was the case or me not understanding what I was doing.

:+1::v:


#4

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