Why does expression (true == true == true) produce a syntax error?

Association direction, which controls the order of operators having their arguments evaluated, is not defined for the == method, same as for ===, !=, =~ and <=> methods as well (all of which have the same precedence and form a separate precedence group exclusively).

Documentation

Thus evaluation order in case of multiple operators from the list mentioned above being chained in a row should be set explicitly via either

  • parenthesis ():

    (true == true) == true # => true
    true == (true == true) # => true
    
  • or dot operator . (can be omitted for the last equality check in a row):

    true .== true == true # => true
    

Leave a Comment

techhipbettruvabetnorabahisbahis forumuedusedueduseduseduseduedueduedusedus