SciTE problem with gets method

I just today started out with Ruby and when I tried to use the gets
method, I get a black box with a blinking cursor in it. Nothing
happens when I press any buttons.

Why?

[email protected] wrote:

I just today started out with Ruby and when I tried to use the gets
method, I get a black box with a blinking cursor in it. Nothing
happens when I press any buttons.

print("Enter some text: ")
$stdout.flush
input = gets
puts(“You entered <#{input}>”)

Running in SciTE it open a cmd prompt (where the ruby interpreter is
called).

Output goes to SciTE-output pane - so you can ignore the cmd-window.
Just switch back to SciTE to enter the data and see the output.

Stefan

That works!

I actually had tried this before, but I think the confusion came from
using the variable x and not the one I had just defined that made the
error message so confusing. I guess I should stop my 2AM coding
sessions.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs