Skip to content

Latest commit

 

History

History
61 lines (47 loc) · 857 Bytes

File metadata and controls

61 lines (47 loc) · 857 Bytes

逻辑运算符

名称 描述
&& 逻辑与 AND
! 逻辑非 NOT
|| 逻辑或 OR
XOR 逻辑异或 XOR

在 nGQL 中,非 0 数字将被视为 true 。逻辑运算符的优先级参见 Operator Precedence

  • &&

逻辑与 AND:

nebula> YIELD -1 && true;
================
| (-(1)&&true) |
================
| true         |
----------------
  • !

逻辑非 NOT:

nebula> YIELD !(-1);
===========
| !(-(1)) |
===========
| false   |
-----------
  • ||

逻辑或 OR:

nebula> YIELD 1 || !1;
=============
| (1||!(1)) |
=============
| true      |
  • XOR

逻辑异或 XOR:

nebula> YIELD (NOT 0 || 0) AND 0 XOR 1 AS ret;
=========
| ret   |
=========
| true  |
---------