Interactive Ruby Shell

from Wikipedia, the free encyclopedia
Interactive Ruby Shell

Interactive Ruby Shell.png
This is what irb looks like when used ...
Basic data

developer Keiju Ishitsuka
Current  version 1.2.0
( December 7, 2019 )
operating system platform independent
programming language Ruby
category Ruby command line interpreter
License Ruby license
GPL
German speaking No
ruby-lang.org

Interactive Ruby Shell ( IRB ) is a command line interpreter (REPL) for the Ruby programming language .

The program is started from the command line and enables the execution of Ruby commands, whereby the result is returned immediately. This allows you to experiment with Ruby in real time or perform smaller calculations with Ruby on an ad hoc basis, like with a pocket calculator . IRB knows the commands last entered, which can be retrieved using the arrow keys and, if necessary, edited in order to simplify the issuing of similar commands and repetitions. On Posix systems ( Linux , Unix ) you have access to job control , can communicate like a shell script directly over the Internet and interact with servers.

The software was developed by Keiju Ishitsuka and is usually included with Ruby.

Use:

irb [ Optionen ] [ Programmdatei ] [ Argument1... ]

example

irb(main):001:0> n = 5
=> 5
irb(main):002:0> def fact(n)
irb(main):003:1>   if n <= 1
irb(main):004:2>     1
irb(main):005:2>   else
irb(main):006:2*     n * fact(n - 1)
irb(main):007:2>   end
irb(main):008:1> end
=> nil
irb(main):009:0> fact(n)
=> 120

Web links

Individual evidence

  1. rubygems.org . (accessed on July 6, 2020).
  2. Release 1.2.0 . December 7, 2019 (accessed July 6, 2020).
  3. Ruby's license terms. Retrieved January 15, 2012 .