Trying to run one-line Ruby command (i.e. PUTS) in my workspace


#1

Hi, can someone help me? I’ve been using c9.io for about 15 minutes, and I see how I can save Ruby statements as an .rb file, and then run that file, but I don’t see a way to run an individual statement (say, puts(“Hello World”)) and get an immediate response. Is this possible to do?


#2

In order to do that, you need to enter the Interactive Ruby console. You can enter it by typing the irb in your terminal.

After you are inside, you can type in Ruby as you would normally do in .rb files.

To exit Interactive Ruby simply type exit or use Ctrl+D shortcut.

By the way, you can simply use puts "Hello World" instead of puts("Hello World") for printing stuff.