Flowgorithm - Documentation - Expressions
Flowgorithm - Documentation - Expressions
Operators
About
Expressions combine operators used in the two major families of programming languages. The "BASICfamily" contains
English keywords and operators. The "Cfamily" (which includes C, Java, C#) is far more symbolic.
Since both families are supported, there are a number of redundant operators. These are:
Negation ! not
Modulus % mod
Equality == =
Inequality != <>
Logical Or || or
Flowgorithm also adds a few unique Visual Basic operators since if they have helpful, clearly defined, semantics
Visual Basic Operator Name
& String Concatenation
^ Exponent
In Java and C#, the "+" operator is used for both string concatenation and addition. This can be quite confusing given the
rather complex semantics. In Flowgorithm, addition will only work with numbers. The ampersand "&" is used for
concatenation.
Also, C# and Java lack an exponent operator instead relying their respective Math classes. Flowgorithm uses the Visual
Basic "^".
Precedence
The following are the precedence levels from high (evaluated first) to low.
7 Exponent ^ The exponent operator does not exist in C# or Java.
3 Relational > >= < <=
== = != <>
2 Logical And and &&
1 Logical Or or ||
Examples
1 + 3 ^ 2 10
10 * 2 + 5 * 6 50 10 * 2 and 5 * 6 have higher precedence than addition. The addition is done last.
7 * (4 ‐ 1) 21 Parenthesis are used for subexpressions, which are evaluated as a whole.
6 / 3 * 2 4 In mathematics, multiplication and division have the same precedence levels. So,
they are evaluated lefttoright. The "PEMDAS" acronym, used in highschool, is a
tad misleading.
10 mod 3 1 Modulus math gives the remainder from division
10 % 3 1 Same expression, but using the CFamily operator