0% found this document useful (0 votes)
123 views

Flowgorithm - Documentation - Expressions

The document discusses operators used in programming languages, noting that BASIC-family languages use English keywords while C-family languages use more symbolic operators. It provides tables comparing common operators between the two families and precedence levels from high to low. Examples are given to demonstrate how expressions are evaluated based on operator precedence.

Uploaded by

istiqlal
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
123 views

Flowgorithm - Documentation - Expressions

The document discusses operators used in programming languages, noting that BASIC-family languages use English keywords while C-family languages use more symbolic operators. It provides tables comparing common operators between the two families and precedence levels from high to low. Examples are given to demonstrate how expressions are evaluated based on operator precedence.

Uploaded by

istiqlal
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

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

Modulus % 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 Modulus math gives the remainder from division

10 % 3 1 Same expression, but using the C­Family operator

You might also like