View Full Version : Delay with Ruby until keyprompt ?
Dave_Connor
October 13th, 2008, 01:14 AM
I want to get into more interactive programming and want with before ruby to print out something I could set up a key prompt like enter or y or n before ruby prints something. How can this be done ?
meanburrito920
October 13th, 2008, 05:30 AM
If you are looking for the program to simply wait for user input, use gets. otherwise, look into a multithreading implementation. do a google search for threads in ruby.
loell
October 13th, 2008, 05:36 AM
it's rawline (http://rubyforge.org/projects/rawline/)
loell
October 13th, 2008, 07:32 AM
found another snippet. ;)
#!/usr/bin/env ruby -w
require "highline/system_extensions"
include HighLine::SystemExtensions
print "Enter one character: "
char = get_character
puts char.chr
Powered by vBulletin® Version 4.2.2 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.