[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: quick newbie true/false/nil question

Jeff

2/13/2007 8:30:00 PM



On Feb 13, 2:24 pm, "Jason Mayer" <slam...@gmail.com> wrote:
> I ran across this line of code today, and it doesn't make sense to me.
>
> if ((klass = CommDispatcher.check_hash(path)) == nil)
>
> How would that value ever equal nil? I thought that if klass failed to be
> assigned to the value of CommDispatcher.check_hash(path) then the value
> would be false and if it was assigned to the value of
> CommDispatcher.check_hash(path) it would be true.. How would it be nil?
>
> Thanks!

I'm not familiar with the CommDispatcher class, but it looks like
klass will be assigned whatever the return value of check_hash()
returns, whether that's nil or false or something else.

Jeff


4 Answers

Gary Wright

2/13/2007 8:53:00 PM

0


On Feb 13, 2007, at 3:34 PM, Jason Mayer wrote:
> Right... but isn't the assignment of the value 'nil' going to
> return true
> since the assignment succeeded? I remember screwing up a program by
> forgetting to put in the extra = sign once... my if blah = blah2
> statement
> always returned true because the assignment occurred.

The value associated with an assignment statement is the value of
the right hand side of the assignment.

It is somewhat nonsensical to ask whether an assignment 'succeeds' or
not.
The only way for an assignment to fail would be a syntax error or some
sort of exception while evaluating the right hand side, in which case
the assignment won't be evaluated as an expression at all.

It may help to remember that nil is simply a literal reference to a
particular object in the same way that 1 is a literal reference for a
particular Fixnum object (the one that behaves like the number 1).

Don't think of nil as meaning the absence of any object but instead
think of it as the unique object known as nil.

Gary Wright




mg

1/6/2013 8:21:00 PM

0

On Jan 6, 12:57 pm, awouk <aw...@blackhole.nyx.net> wrote:
> On Sat, 05 Jan 2013 at 19:45 GMT, mg <mgkel...@yahoo.com> wrote:
> > . . .
>
> >> Al Jazeera plans to give Current TV a significant makeover, rename the
> >> network Al Jazeera America and turn it into a news channel with a heavy
> >> focus on international coverage. The mix of news for Al Jazeera America will
> >> be 60% domestic and 40% international, said Stan Collender, a spokesman for
> >> the network.
>
> > . . .
>
> > I can't believe that the managers at Al Jazeera would be stupid enough
> > to not understand this, but Americans have very little interest in
> > international news, unless it's something that is really dramatic like
> > Iran getting nuked, for example.
>
> bbcamerica already offers such a channel and it seems to be doing well.
> al-jazeera would offer a different point of view to the same audience,
> and would add a muslim compinent. cable channels are not like broadcast
> channels.
>
> the bbcamerica channel is a useful alternative to the so-called
> us news channels.
> --
> Mussolini's definition of fascism: "the moment when you couldn't
> put a cigarette paper between political and corporate power."
>         "to email me, delete blackhole from my return address

Without look at the map, tell me where Sudan is relative to
Egypt. :-)

Werner

1/6/2013 8:47:00 PM

0

On Saturday, January 5, 2013 2:45:24 PM UTC-5, mg wrote:
>
> . . .
>
>
>
> I can't believe that the managers at Al Jazeera would be stupid enough
>
> to not understand this, but Americans have very little interest in
>
> international news, unless it's something that is really dramatic like
>
> Iran getting nuked, for example.


Perhaps this purchase was just a payoff for some political favor.

awouk

1/7/2013 7:07:00 PM

0

On Sun, 06 Jan 2013 at 20:21 GMT, mg <mgkelson@yahoo.com> wrote:
> On Jan 6, 12:57?pm, awouk <aw...@blackhole.nyx.net> wrote:
>> On Sat, 05 Jan 2013 at 19:45 GMT, mg <mgkel...@yahoo.com> wrote:
>> > . . .
>>
>> >> Al Jazeera plans to give Current TV a significant makeover, rename the
>> >> network Al Jazeera America and turn it into a news channel with a heavy
>> >> focus on international coverage. The mix of news for Al Jazeera America will
>> >> be 60% domestic and 40% international, said Stan Collender, a spokesman for
>> >> the network.
>>
>> > . . .
>>
>> > I can't believe that the managers at Al Jazeera would be stupid enough
>> > to not understand this, but Americans have very little interest in
>> > international news, unless it's something that is really dramatic like
>> > Iran getting nuked, for example.
>>
>> bbcamerica already offers such a channel and it seems to be doing well.
>> al-jazeera would offer a different point of view to the same audience,
>> and would add a muslim compinent. cable channels are not like broadcast
>> channels.
>>
>> the bbcamerica channel is a useful alternative to the so-called
>> us news channels.
>> --
>> Mussolini's definition of fascism: "the moment when you couldn't
>> put a cigarette paper between political and corporate power."
>> ? ? ? ? "to email me, delete blackhole from my return address
>
> Without look at the map, tell me where Sudan is relative to
> Egypt. :-)
>

south.


--
Mussolini's definition of fascism: "the moment when you couldn't
put a cigarette paper between political and corporate power."
"to email me, delete blackhole from my return address