Answer the question
In order to leave comments, you need to log in
How to prevent Ruby console from closing after executing code?
Greetings. Began to study Ruby, there was a corresponding question.
How can I make the Ruby console not close after executing the code, but remain open until a certain key is pressed (For example, Enter)?
Answer the question
In order to leave comments, you need to log in
print 'Введите что-нибудь: '
t = STDIN.gets
puts "Вы ввели: #{t}"
What do you mean by "Ruby console"?
By default, there are two tools for working with Ruby.
Ruby is an Interpreted object-oriented scripting language that executes code from a .rb text file.
Of course, after executing the code, such an interpreter will complete its work.
IRB -- Interactive Ruby Shell. An interactive console where code executes line by line as you type code.
You can end the console manually (ctrl+c) or through the commands exit, abort, etc.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question