this is my code
hi = Proc.new {"Hello!"}
hi.call
it puts “Hello!” but it doesn’t let me pass.
it says Oops, try again. It looks like your proc doesn’t puts ‘Hello!’ when called.
this is my code
hi = Proc.new {"Hello!"}
hi.call
it puts “Hello!” but it doesn’t let me pass.
it says Oops, try again. It looks like your proc doesn’t puts ‘Hello!’ when called.
That’s probably because you’re returning “Hello!”, not printing it. What are the instructions of the exercise?
try using ‘do’ and ‘puts’ instead of the curly brackets, as in the previous exercise.
or you could fix your original code by just adding one word.
it should be
Proc.new {puts “Hello!”}
hi = Proc.new { puts “Hello!” }
hi.call
^works!
Here is my code that worked:
hi = Proc.new do
puts"Hello!"
end
hi.call
hi = Proc.new { puts “Hello!” }
hi.call
hi=proc
proc=Proc.new { puts “Hello!”}
proc.call