Main About Download Documentation Resources

Operators

About

Expressions combine operators used in the two major families of programming languages. The "BASIC-family" contains English keywords and operators. The "C-family" (which includes C, Java, C#) is far more symbolic.

Since both families are supported, there are a number of redundant operators. These are:

Operator C Family BASIC Family
Negation ! not
Modulo % mod
Equality == =
Inequality != <>
Logical And && and
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.

Level Name Operators Notes
8 Unary -  !  not In Visual Basic, "not" precedence level is far lower - above "and", but below all relational operators.
7 Exponent ^ The exponent operator does not exist in C# or Java.
6 Multiply *  /  %  mod Division will always be high-precision (floating point)
5 Addition +  -  "+" will only work with numbers.
4 Concatenate & C# and Java use the ambiguous "+" operator for addition and concatenation.
3 Relational >  >=  <  <=
==  =  !=  <>
 
2 Logical And and  &&  
1 Logical Or or  ||  

Examples

Expression Result Notes
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 left-to-right. The "PEMDAS" acronym, used in high-school, is a tad misleading.
10 mod 3 1 Modulo math gives the remainder from division
10 % 3 1 Same expression, but using the C-Family operator