Skip to content

&& || 的优先级反人类呀 #45

Open

Description

@xujingshi

true || true && false 返回false 正常不是应该&& 优先级高于||吗

Activity

  1. Gu-f commented on May 27, 2022

    @Gu-f

    规则中 && 和 || 优先级相同,从左到右依次计算
    a==1 && b==2 || c==3 --> (((a==1) && (b==2)) || (c==3))
    如果想要符合正常优先级,可使用括号true || (true && false)
    或修改parser解析时的优先级权重

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions