Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何在不按回车键的情况下从控制台读取单个字符?
在红宝石中,我只会使用:
require 'io/console' input = STDIN.getch
尝试这个:
char = STDIN.raw &.read_char p char