Procedures
void Main();
A Procedure is defined as a set of coded instructions that tell a computer how to perform certain calculations. A bulk of scripting takes place within these so-called procedures.

Usage

Main()

Every Flowscript has at least one procedure, usually called Main(), which is used as the entry point. When the script is executed (or run) by the game, it will follow the path starting from the first line of code in Main().
1
void Main() // Procedure declaration
2
{
3
2 + 2; // Statement, would equal 4 once compiled and run
4
}
Copied!
Every line of code is referred to as a statement. A statement ends with a semicolon to tell the compiler that the logical expression is complete. Think of it like saying "OVER" when speaking into a walkie-talkie.
Notice the void keyword, which indicates the data type that the procedure returns.
A void doesn't return anything, it just runs whatever code is contained in it, and then continues from whatever line it was called on. When the end of Main() is reached, the entire script has finished executing.

Return Types

A procedure can return a value once calculations have finished if it isn't a void. The returned value is then used in calculation wherever the procedure was called, as if it was a variable.
1
void Main() // Procedure declaration
2
{
3
2 + GetNumber(); // Statement, would equal 5 once compiled and run
4
}
5
6
int GetNumber() //Procedure declaration
7
{
8
return 3; // Return statement
9
}
Copied!
These are the Data Types a procedure can return:
Name
Description
Example Value
void
Default procedure type. Does not return anything.
int
Integer. A whole number between -2147483648 and 2147483647.
24
float
Floating-point. A decimal between 1.175494351 E - 38 and 3.402823466 E + 38.
24.01f
bool
Boolean. A true or false value. Can also be represented by 1 or 0.
true
1

Parameters

A parameter is an argument that a procedure requires in order to do its calculations. This is just like in algebra, where you would need to know the value of x first in order to find y in x + y = 30.
These could be the same data types as above. For example:
1
void Main() // Procedure declaration
2
{
3
GetNumber( 2, 15 ); // Statement, would equal 17 once compiled and run
4
}
5
6
int GetNumber( int inputNumber, int anotherNumber ) // Procedure declaration with parameters
7
{
8
return inputNumber + anotherNumber; // Return statement
9
}
Copied!

Conclusion

Procedures, return types and parameters are major concepts that we will continue to build on in the upcoming section. Don't worry if you find this overwhelming. The more Flowscript you read and edit, the more natural this will be to work with.
Keep reading to learn about another major concept-- variables!