Questions tagged [irb]

Interactive Ruby (IRB) is a shell for programming in Ruby. The program can be launched from a command prompt and allows the execution of Ruby commands line by line.

Interactive Ruby Shell (IRB) is a shell for programming in Ruby. The program can be launched from a command prompt and allows the execution of Ruby commands line by line. It features command history, line editing capabilities, and job control, and is able to communicate directly as a shell script over the Internet and interact with a live server. It was developed by Keiju Ishitsuka.

772 questions
-3
votes
4 answers

How do I randomly return an element from an array in Ruby

I will like to select a name randomly from an array list then display either in Capital or Lowercase For example names= ["James", "John", "Jane"] Output should be: JOHN or john or jane or JAMES or JANE or james Please help! I have tried using the…
-3
votes
1 answer

Stuck in Ruby's IRB

n00b query :: Okay so I'm messing around with Ruby's IRB, and it works (at least it appears to) but was wondering how to escape from its clutches without having to close and reopen the Windows Powershell. In short; clear the IRB to get back to the…
-3
votes
3 answers

When I $ load 'game.rb' in my 'irb' console it returns a stack of lines the first of which contains "Could not load SDL. (LoadError)"

This is the output from $ gem env: Michels-MacBook-Pro:~ michelfrechette$ gem env RubyGems Environment: - RUBYGEMS VERSION: 2.5.1 - RUBY VERSION: 2.2.3 (2015-08-18 patchlevel 173) [x86_64-darwin15] - INSTALLATION DIRECTORY:…
Michel Frechette
  • 197
  • 1
  • 2
  • 8
-4
votes
1 answer

ruby IRB vs code in an IDE why IRB brings results and IDE doesnt?

Today I was given a correct solution. I ran it beautifully in IRB and it interprets is perfectly. However if I paste that code in a ide and then I call the program from the console, it shows nothing, although it runs. If I add a puts to see…
Arminius
  • 606
  • 1
  • 6
  • 19
-5
votes
1 answer

How to write block in IRB?

For example, I want to implement this code in IRB, but it has single-line input so I can get how to write block there. a = [3, 2, 1] a[3] = a[2] - 1 a.each do |elt| print elt+1 end
Billy Logan
  • 2,470
  • 6
  • 27
  • 45
-6
votes
2 answers

Why is it helpful to use irb (as opposed to a GUI-based testing method) when coding with Ruby?

I've read that the purpose of irb when programming with Ruby is to help test code in real-time. I've learned HTML and CSS prior to this, and at that time I was able to test my code by simply opening the page in a browser and saving/refreshing the…
Richie Thomas
  • 3,073
  • 4
  • 32
  • 55
1 2 3
51
52