| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
4.3 Operators
Gmsh's operators are similar to the corresponding operators in C and C++. Here is the list of the unary, binary and ternary operators currently implemented.
operator-unary-left:
operator-unary-right:
operator-binary:
-
^ Exponentiation.
-
* Multiplication.
-
/ Division.
-
% Modulo.
-
+ Addition.
-
- Subtraction.
-
== Equality.
-
!= Inequality.
-
> Greater.
-
>= Greater or equality.
-
< Less.
-
<= Less or equality.
-
&& Logical `and'.
-
|| Logical `or'. (Warning: the logical `or' always implies the evaluation of both arguments. That is, unlike in C or C++, the second operand of
||is evaluated even if the first one is true).
operator-ternary-left:
operator-ternary-right:
-
: The only ternary operator, formed by operator-ternary-left and operator-ternary-right, returns the value of its second argument if the first argument is non-zero; otherwise it returns the value of its third argument.
The evaluation priorities are summarized below(5) (from stronger to
weaker, i.e., * has a highest evaluation priority than +).
Parentheses () may be used anywhere to change the order of
evaluation:
-
(),[],.,# -
^ -
!,++,--,-(unary) -
*,/,% -
+,- -
<,>,<=,>= -
==,!= -
&& -
|| -
?: -
=,+=,-=,*=,/=
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
