Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
Re: operator |=
Paul Danese
11/6/2007 12:12:00 PM
You might be thinking about ||=3D
||=3D assigns a value to a variable if the variable is nil
e.g.=20
x =3D 5
x ||=3D 88
x #=3D> 5
y =3D nil
y ||=3D 88
y # =3D> 88
I believe a |=3D b "ORs" the bits in a and b and assigns them to a
-----Original Message-----
From: news [mailto:news@ger.gmane.org] On Behalf Of Fernando Cacciola
Sent: Tuesday, November 06, 2007 6:58 AM
To: ruby-talk ML
Subject: operator |=3D
Hi people,
Did I dream about an opeartor |=3D?
I can't find any reference to it in the online docs, yet I think I've
seen=20
it in some samples.
What does it do?
TIA
--=20
Fernando Cacciola
SciSoft
http://fcacciola....
=0AThis email and any attached files are confidential and intended solel=
y for the intended recipient(s). If you are not the named recipient you=
should not read, distribute, copy or alter this email. Any views or opi=
nions expressed in this email are those of the author and do not represe=
nt those of the company. Warning: Although precautions have been taken=
to make sure no viruses are present in this email, the company cannot=
accept responsibility for any loss or damage that arise from the use=
of this email or attachments.
2 Answers
Fernando Cacciola
11/6/2007 12:57:00 PM
0
Paul Danese wrote:
> You might be thinking about ||=
Ha, ya, that one... ;)
Thank you.
> I believe a |= b "ORs" the bits in a and b and assigns them to a
Oh, just like in C.... who would have thought (just kiding:)
Best
Fernando Cacciola
SciSoft
http://fcacciola....
Rick DeNatale
11/6/2007 3:29:00 PM
0
On 11/6/07, Paul Danese <pdanese@rib-x.com> wrote:
> You might be thinking about ||=
> ||= assigns a value to a variable if the variable is nil
To be precise, it assigns a value to a variable which is either
undefined, nil or false.
--
Rick DeNatale
My blog on Ruby
http://talklikeaduck.denh...
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Re: operator |=
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password