[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

operators in ruby

dare ruby

11/23/2007 3:26:00 AM

How to use logical operators in ruby?

Logical AND, OR, NOT..

In other languages like java &&, ||, ! is used. how we have to use it in
ruby.

A sample code in java, please explain it in ruby.

if((namespace == attributeUri[ i ] ||
namespace.equals(attributeUri[ i ]) )
&& name.equals(attributeName[ i ]) )

Please do the same in ruby

Thanks in advance
--
Posted via http://www.ruby-....

9 Answers

TerryP

11/23/2007 3:41:00 AM

0

Martin Durai wrote:

> How to use logical operators in ruby?
>
> Logical AND, OR, NOT..
>
> In other languages like java &&, ||, ! is used. how we have to use it in
> ruby.
>
> A sample code in java, please explain it in ruby.
>
> if((namespace == attributeUri[ i ] ||
> namespace.equals(attributeUri[ i ]) )
> && name.equals(attributeName[ i ]) )
>
> Please do the same in ruby
>
> Thanks in advance

It's just a matter of preference, use english or C-style symbols. The C-Stye
has precedence over the keyword versions (e.g. || rather then 'or' ).

Operators and Precedence (Top to bottom)
:: .
[]
**
-(unary) +(unary) ! ~
* / %
+ -
<< >>
&
| ^
> >= < <=
<=> == === != =~ !~
&&
||
... ...
=(+=, -=...)
not
and or

All of the above are just methods except these:
=, ::, ., .., ..., !, not, &&, and, ||, or, !=, !~

In addition, assignment operators(+= etc.) are not user-definable.

yermej

11/23/2007 3:42:00 AM

0

On Nov 22, 9:26 pm, Martin Durai <mar...@angleritech.com> wrote:
> How to use logical operators in ruby?
>
> Logical AND, OR, NOT..
>
> In other languages like java &&, ||, ! is used. how we have to use it in
> ruby.
>
> A sample code in java, please explain it in ruby.
>
> if((namespace == attributeUri[ i ] ||
> namespace.equals(attributeUri[ i ]) )
> && name.equals(attributeName[ i ]) )
>
> Please do the same in ruby
>
> Thanks in advance
> --
> Posted viahttp://www.ruby-....

http://whytheluckystiff.net/rub...

Phrogz

11/23/2007 4:20:00 AM

0

On Nov 22, 8:26 pm, Martin Durai <mar...@angleritech.com> wrote:
> How to use logical operators in ruby?
>
> Logical AND, OR, NOT..
>
> In other languages like java &&, ||, ! is used. how we have to use it in
> ruby.
>
> A sample code in java, please explain it in ruby.
>
> if((namespace == attributeUri[ i ] ||
> namespace.equals(attributeUri[ i ]) )
> && name.equals(attributeName[ i ]) )
>
> Please do the same in ruby

Martin, please read a primer on Ruby and Java before posting all your
questions asking people to do each piece of your work for you. It
seems that you have a project or job to convert something from Java to
Ruby, but you don't seem to know either.

Learn the languages - even the basics - and you'll be able to do this
better on your own.

cloud dreamer

11/2/2013 10:59:00 AM

0

On 02/11/2013 9:10 AM, trotsky wrote:
> On 11/2/13 6:16 AM, Caprice wrote:
>> On Fri, 01 Nov 2013 18:07:56 -0700, RichA wrote:
>>
>>> [Edward Snowden] is an ongoing threat to U.S. security. He should be
>>> eliminated.
>>
>> Your advocacy of the cold-blooded murder of a nonviolent man has been
>> noted, k????k.
>
>
> He does that all the time. He's either a serial killer or a dickless
> wonder living in a basement somewhere.
>
>


Or both.

..

trotsky

11/2/2013 12:57:00 PM

0

On 11/2/13 6:59 AM, cloud dreamer wrote:
> On 02/11/2013 9:10 AM, trotsky wrote:
>> On 11/2/13 6:16 AM, Caprice wrote:
>>> On Fri, 01 Nov 2013 18:07:56 -0700, RichA wrote:
>>>
>>>> [Edward Snowden] is an ongoing threat to U.S. security. He should be
>>>> eliminated.
>>>
>>> Your advocacy of the cold-blooded murder of a nonviolent man has been
>>> noted, k????k.
>>
>>
>> He does that all the time. He's either a serial killer or a dickless
>> wonder living in a basement somewhere.
>>
>>
>
>
> Or both.


Excellent point.


--
Never post something on the internet unless you have a point of
reference. You will look like a moron otherwise.

Liberal $500 million tax dollar disaster

11/2/2013 4:50:00 PM

0

On Saturday, November 2, 2013 7:16:07 AM UTC-4, Caprice wrote:
> On Fri, 01 Nov 2013 18:07:56 -0700, RichA wrote:
>
>
>
> > [Edward Snowden] is an ongoing threat to U.S. security. He should be
>
> > eliminated.
>
>
>
> Your advocacy of the cold-blooded murder of a nonviolent man has been
>
> noted, kòók.

Enemies of America should be eliminated. Only a moron like yourself thinks they all carry guns.

Barb May

11/2/2013 5:30:00 PM

0

RichA wrote:
> On Saturday, November 2, 2013 7:16:07 AM UTC-4, Caprice wrote:
>> On Fri, 01 Nov 2013 18:07:56 -0700, RichA wrote:
>>
>>
>>
>>> [Edward Snowden] is an ongoing threat to U.S. security. He should
>>> be
>>
>>> eliminated.
>>
>>
>>
>> Your advocacy of the cold-blooded murder of a nonviolent man has been
>>
>> noted, k??k.
>
> Enemies of America should be eliminated.

Like you?
--
Barb


Michael Black

11/2/2013 5:55:00 PM

0

Ubiquitous

11/2/2013 7:01:00 PM

0

gmsingh@email.com wrote:
> Someone's sockuppet wrote:
>> On Fri, 01 Nov 2013 18:07:56 -0700, RichA wrote:

>>> [Edward Snowden] is an ongoing threat to U.S. security. He should
>>> be eliminated.
>>
>> Your advocacy of the cold-blooded murder of a nonviolent man has been
>> noted, k????k.
>
>He does that all the time. He's either a serial killer or a dickless
>wonder living in a basement somewhere.

Holding conversations with your sock puppets again?

--
Q: Why is ObamaCare like a turd?
A: You have to pass it to see what's in it.