Clueless Clueless - 1 year ago 84
Ruby Question

Used require, stdin not being highlighted or working

What I've been trying to do is a simple noob project just by trying to take in
minor keys. Don't know if this is a ruby version or aptana weirdness because "STDIN.getch" and "raise" are not highlighted as if they are important or work at all. The code runs but nothing happens. the else does not fire either.

require 'io/console'

def yesno
case STDIN.getch
when "Y" then true
when "N" then false
else raise "Invalid character."

Answer Source

You're defining a method yesno but never invoking it.

Just write


after the final end

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download