[#138] Thread Problems — Reimer Behrends <behrends@...>

I have been looking at the thread implementation of Ruby for the past

21 messages 1998/12/23
[#164] Re: Thread Problems — matz@... (Yukihiro Matsumoto) 1999/01/05

Hi.

[#167] Makefiles and -lcurses — Klaus.Schilling@... 1999/01/05

Julian Fondren writes:

[#168] Re: Makefiles and -lcurses — Julian Fondren <julian@...> 1999/01/05

OpenBSD has ncurses and it's own ocurses, and I prefer the latter.

[ruby-talk:00118] Re: STDIN integer assignment

From: Clemens Hintze <c.hintze@...>
Date: 1998-12-17 09:55:08 UTC
List: ruby-talk #118
On 16 Dec, Julian Fondren wrote:
> Hello,
> 

Hello,

> in the following script, how would I be able to have the input along the
> lines of ``10 100 <ENTER>'' assign ans1 to 10 and ans2 to 100?
> 
> 

[...]

I do such things as follows:

   ans1 = ans2 = nil
   ans1, ans2 = $1.to_i, $2.to_i if STDIN.gets =~ /(\d+)\s+(\d+)/
   invalid_input if not ans1 or not ans2
   
or

   if STDIN.gets =~ /(\d+)\s+(\d+)/
      ans1, ans2 = $1.to_i, $2.to_i
   else
      invalid_input
   end

The first example has the advantage, that ans1 and ans2 are already
initialized.

[...]

In This Thread