ruby - (a && b) versus (a and b) -


given :

a=true b=false 

why can :

puts [a && b, || b]  #[false, true] 

but not

puts [a , b, or b]  

syntax error, unexpected keyword_and, expecting ']' puts [a , b, or b]

apparently, operator precedence comma higher "and" lower &&.

putting parenthesis around elements works:

[(a , b), (a or b)] 

Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -