From: Zach Dennis Date: 2004-09-08T23:18:16+09:00 Subject: Re: Order of Operations Question ts wrote: >>>>>>"Z" == Zach Dennis writes: >>>>>> >>>>>> > >Z> Zach Dennis wrote: > > > >>>dir = Dir.new( d ) if( File.directory?( d=$*.shift ) ) >>> >>> > >Z> Please ignore...i realized I was passing in a nonexistent directory. > > I hope that you have seen that ruby will call the method #d in Dir.new() > if `d' was not previously seen as a local variable > > >Guy Decoux > > > Yeah, I learned that the hard way ;), I am initializing d to nil just above it....but while we're on this topic I have another order of operations question.....It involves the && in a conditional statement d = nil dir = Dir.new( d ) if( $*.length > 0 && File.directory?( d=$*.shift ) ) I cannot get this statement to work either, and I have tried flip flopping the conditions around, but it always complains when I don't pass in a command line argument. If $* is an empty array shouldn't Ruby test the first condition and see that it is false, then quit and do not test the second condition? Thanks, Zach