From: Brian Candler Date: 2011-08-09T21:46:08+09:00 Subject: Re: need help to run my first program eman a. wrote in post #1015678: > but what about the code which written in the interactive ruby. > is that write in the one file .rb if yes, how can i find it. > > and if i need to write .rb file containing some code and need to run it > uding my installion to ruby 1.8.7. what can i do? They're two different ways to run code. (1) Start irb. Type in Ruby expressions. They are executed immediately $ irb irb(main):001:0> 2 + 3 => 5 irb(main):002:0> 3.times { puts "hello" } hello hello hello => 3 This is the best way for experimenting with Ruby or testing out some feature you've just learned, as if there's an error you can just hit cursor-up and edit/rerun the line. (2) Open a text editor (even notepad will do), write some ruby in it. Save it, with extension .rb. Then run it $ ruby myprog.rb This will run all the code in the file. This is the best way to write a larger program. -- Posted via http://www.ruby-forum.com/.