【发布时间】:2013-01-24 03:56:27
【问题描述】:
我想找到一种方法让我的脚本等到用户点击 ENTER,同时使用 if...end
input = 3
if input > 2
puts "input is greater than 2"
gets
puts "this shouldn't appear before I type ENTER"
end
这不起作用,因为我得到了
$input is greater than 2
$this shouldn't appear before I type ENTER
我应该使用什么来代替gets 来暂停脚本?
感谢您的宝贵时间
【问题讨论】:
-
您是从控制台阅读吗?还是来自文件?
-
代码暂停对我来说很好。周围有更多代码吗?
标签: ruby