Interactive Ruby (IRb)


Interactive Ruby (IRb) provides a shell for experimentation. Within the IRb shell, you can immediately view expression results, line by line.

This tool comes along with Ruby installation so you have nothing to do extra to have IRb working.

Just type irb at your command prompt and an Interactive Ruby Session will start as given below:

      $irb
      irb 0.6.1(99/09/16)
      irb(main):001:0> def hello
      irb(main):002:1> out = "Hello World"
      irb(main):003:1> puts out
      irb(main):004:1> end
      nil
      irb(main):005:0> hello
      Hello World
      nil
      irb(main):006:0>
      

Do not worry about what I did here. You will learn about all these steps in subsequent chapters.