# Results are different by running script via irb and ruby

**URL:** <https://rubytalk.org/t/results-are-different-by-running-script-via-irb-and-ruby/57540>\
**Category:** ruby-talk\
**Created:** [24 February 2010 15:18 UTC](https://rubytalk.org/t/results-are-different-by-running-script-via-irb-and-ruby/57540 "2010-02-24T15:18:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![John\_Wu](https://avatars.discourse-cdn.com/v4/letter/j/278dde/32.png) [@John\_Wu](https://rubytalk.org/u/John_Wu)\
**Post date:** [24 February 2010 15:18 UTC](https://rubytalk.org/t/results-are-different-by-running-script-via-irb-and-ruby/57540/1 "2010-02-24T15:18:10Z")

</div>

Hey,

I am new to ruby. I have the following simple ruby script  
def make\_show\_name(show)  
&nbsp;&nbsp;return Proc.new {|host| show + " with " + host}  
end  
show = make\_show\_name("Practical Cannibalism")  
show.call("H. Annabellector")

when run this using irb, it prints out: Practical Cannibalism with H.  
Annabellector  
but when I saved this as test.rb and type ruby test.rb, it prints out  
nothing.

What is the problem here?

Thanks!

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

---

<div class="post-metadata">

**Author:** ![Fleck\_Jean-Julien](https://avatars.discourse-cdn.com/v4/letter/f/65b543/32.png) [@Fleck\_Jean-Julien](https://rubytalk.org/u/Fleck_Jean-Julien)\
**Post date:** [24 February 2010 15:48 UTC](https://rubytalk.org/t/results-are-different-by-running-script-via-irb-and-ruby/57540/2 "2010-02-24T15:48:27Z")

</div>

Hello,

> I am new to ruby. I have the following simple ruby script  
> def make\_show\_name(show)  
> return Proc.new {|host| show + " with " + host}  
> end  
> show = make\_show\_name("Practical Cannibalism")  
> show.call("H. Annabellector")
> 
> when run this using irb, it prints out: Practical Cannibalism with H.  
> Annabellector  
> but when I saved this as test.rb and type ruby test.rb, it prints out  
> nothing.
> 
> What is the problem here?

irb automaticaly prints out the value of the last expression, but your  
script does not.

Try

puts show.call("H. Annabellector")

and it should be fine.

Cheers,

> **···**
>
> --  
> JJ Fleck  
> PCSI1 Lycée Kléber
