From: Guillaume Marcais Date: 2003-06-17T02:20:20+09:00 Subject: Re: /BEGIN/ .. /END/ file reading What is the life span of the flip-flop "object" (is it an object?) created? Obviously in the code sample it outlived the if statement. But the following (contrived) piece code doesn't work: def test(s) if /^b/ =~ s .. /^e/ =~ s puts s end end while (line = gets) do test(line) end So does it have a scope similar to a local variable? Guillaume. On Mon, 2003-06-16 at 10:55, ts wrote: > >>>>> "G" == Guillaume Marcais writes: > > G> when inside the if statement? > > You have found : when ruby is in a condition (if, unless, while, ...) it > transform a range operator into a flip-flop operator. > > Guy Decoux > > > > > > > >