[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Re: Newbie Question on Operator Precedence?

Shuaib Zahda

10/31/2007 1:42:00 AM

Z T wrote:

> if false or true
> then puts 'then' #----> output is 'then'. OR gets evaluated!
> else puts 'else'
> end
>
> What's the reason? Thanks for all the help, in advance.
>
> ZT

for the if statement it gets evaluated so it is true and "then" is
evaluated.

for puts flase or ture, I tried it. I got the same result of yours.
However, I tried puts false and true. The output was false. I am not
sure about this one.

I tried this and it gave me true

puts "#{false or true}"
It gets evaluated.

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