逻辑表达式

其实最终实现的算法与【算术表达式】一样的:


if x == 1

语法:CompareExpression(x == 1)

------------------------------------------------------------------------------

if x == 1 && y == 2 && z == 3

语法:and(and(x == 1, y == 2), z == 3)

------------------------------------------------------------------------------

if x == 1 || y == 2 && z == 3

语法:or(x == 1, and(y==2, z==3))

------------------------------------------------------------------------------

if x == 1 && y == 2 || z == 3

语法:or(and(x==1, y==2), z==3)

------------------------------------------------------------------------------

if (x == 1 || y == 2) && z == 3

语法:and(or(x==1, y==2), z==3)

------------------------------------------------------------------------------

if x == 1 || y == 2 || z == 3

语法:or(or(x == 1, y == 2), z == 3)

------------------------------------------------------------------------------

if x == 1 && y == 2 || c == 3 && (d == 4 || e == 5 && f == 6) && g == 7

语法: or(and(x == 1, y == 2), and(and(c == 3, or(d == 4, and(e == 5, f == 6))), g == 7)

------------------------------------------------------------------------------

if (d == 4 || e == 5 && f == 6) && x == 1 && y == 2 || c == 3 && g == 7

语法: or(and(and(or(d==4, and(e == 5, f==6)), x == 1), y == 2), and(c == 3, g == 7))

相关推荐