How to run Ruby in Cloud 9


#1

Hello. I’ve been working through learning Ruby and Cloud 9. I understand how to write code in the editor and preview it in Bash (terminal), but I can’t figure out how to enter input. For instance, when I write puts “What’s your name?” in the editor, how/where do I enter input to answer the question (or basically collect user input)? The terminal only prints out my puts statement, but I can’t give input there. What am I missing?


#2

to collect user input you need to write code that reads user input from stdin. after that writing in terminal will work,

print "Type a number: "
line = $stdin.readline()
puts "number is " + line

see http://www.dotnetperls.com/console-ruby