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

javascript - Iterate over array and calculate average values of array-parts -

iphone - Using nested NSDictionary with Picker -

objective c - Newbie question -multiple parameters -