Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- =begin
- Status - Bugged
- I cannot even picture a solution in my mind. Not even close.
- Maybe 'cause I'm new to threading.
- =end
- clock = Thread.new {
- abort_on_exception = true
- loop do
- hms_time = Time.now.strftime("%I:%M:%S")
- print "\rCurrent time - #{hms_time}"
- sleep 0.5
- end
- }
- askname = Thread.new {
- puts "\nWhat's your name?" #Trying to escape from \r with \n, Doesn't work. :\
- name = gets.chomp
- puts name + " is a nice name "
- }
- askname.join
- clock.join
- sleep
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement