How to print two outputs on the same line in window terminal

Hi all,

I want to print two outputs on the same line in window terminal but
don’t know which method is used. Here my script:

print “question 1—”
gets #user will hit enter when he is ready to answer
puts “correct answers is…”

instead of getting output in two lines as

question 1—
correct answer is…

I like to the output on one line as
question 1—correct answer is…

Thanks,

Li

You cannot do this with the normal console. If you need to manipulate
the appearance in that way you’ll need a custom UI.

Thank you Joel.

Hi Joel,

I can print two outputs on the same line on iPad with Rubyi but cannot
do it on window 8.

Hi, Alex!
Instead of: puts “correct answers is…”
try: print “correct answers is…”
and, in some situations: p “correct answers is…”
would do the job.
Ed

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