January 2024
Intermediate to advanced
718 pages
20h 15m
English
If you want to play with Ruby, we recommend Interactive Ruby—irb, for short. irb is a Ruby command-line “shell” similar in concept to an operating system shell (complete with job control). It’s sometimes called a REPL (which is an abbreviation for “Read, Evaluate, Print Loop”) and provides an environment where you can play around with the language in real time.
You launch irb at the command prompt:
| | $ irb |
irb displays the value of each expression as you complete it.
| | $ irb |
| | irb(main):001:0* a = 1 + |
| | irb(main):002:0* 2 * 3 / |
| | irb(main):003:0> 4 % 5 |
| | => 2 |
| | irb(main):004:0> 2 + 2 |
| | => 4 |
| | irb(main):005:0> x = _ |
| | => 4 |
| | irb(main):006:0> x |
| | => 4 |
| | irb(main):007:1* def test |
| | irb(main):008:1* puts "Hello, world!" |
| |
Read now
Unlock full access