Flowgorithm Documentation
Flowgorithm Documentation
Data Types
Integer Data Type
The Integer data type is one of the most commonly used types in
programming. An integer can store a positive or negative whole
number, but can't store fractional values. So, it can store values
such as 5, 42, 1947, but can't store numbers such as 3.2, 4.5, etc...
Identifiers
Any time you define a function or variable, it is given a unique name called an "identifier". To
prevent identifiers from being confused with other items in an expression, they must follow a
naming convention. Every programming language has one and it is fairly consistent from language
to language.
In Flowgorithm, identifiers must adhere to the following rules:
• They must start with a letter.
• After the first letter, the identifier can contain additional letters or numbers.
• Spaces are not allowed.
• They cannot be reserved words or words already defined by Flowgorithm (please see below)
Also note:
• Languages such as Visual Basic and C also allow the underscore character "_".
Flowgorithm, however, does not allow it.
• Identifiers are not case-sensitive.
Reserved Words
Flowgorithm only has a few reserved words that are used in expressions.
and nottrue
false or
mod pi
Precedence
The following are the precedence levels from high (evaluated first) to low.
Level Name Operators Notes
In Visual Basic, "not" precedence level is far lower - above "and",
8 Unary - ! not
but below all relational operators.
7 Exponent ^ The exponent operator does not exist in C# or Java.
* / %
6 Multiply Division will always be high-precision (floating point)
mod
5 Addition + - "+" will only work with numbers.
C# and Java use the ambiguous "+" operator for addition and
4 Concatenate &
concatenation.
> >= <
<=
3 Relational
== = !=
<>
2 Logical Andand &&
1 Logical Or or ||
Examples
Expression ResultNotes
1+3^2 10
10 * 2 + 5 *
50 10 * 2 and 5 * 6 have higher precedence than addition. The addition is done last.
6
7 * (4 - 1) 21 Parenthesis are used for subexpressions, which are evaluated as a whole.
In mathematics, multiplication and division have the same precedence levels.
6/3*2 4 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
Intrinsic Functions
Mathematics
Function Description Version Added
Abs(n) Absolute Value
Arcsin(n) Trigonometric Arcsine 1.7
Arccos(n)Trigonometric Arccos 1.7
Arctan(n) Trigonometric Arctangent
Cos(n) Trigonometric Cosine
Int(n) Integer of a real number
Log(n) Natural Log
Log10(n) Log Base 10
Mathematical sign (-1 if n is negative, 0 if zero, 1 if
Sgn(n)
positive)
Sin(n) Trigonometric Sine
Sqrt(n) Square Root
Tan(n) Trigonometric Tangent
Strings
Function Description
Len(s) Length of a string
Returns a character from the string s at index i. Characters are indexed starting at
Char(s, i)
0.
Built-in Constants
Flowgorithm predefines three commonly used constants. True and False are often used to initialize
Boolean variables. Pi is commonly used in mathematics.
Constant Notes
true Boolean True
false Boolean False
pi Mathematical PI. Approximately 3.1415.