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

php - How can I edit my code to echo the data of child's element where my search term was found in, in XMLReader? -

jQuery Ajax Render Fragments OR Whole Page -

java - Why is BlockingQueue.take() not releasing the thread? -