Creating Variables

From Flowcode Help
Jump to: navigation, search
Gen Project Explorer Add New Variable 01.png

Variables can be created via the Project Explorer.

Variable Name

Enter the variable name including any array size details. Variables can be a maximum of 32 alphanumeric characters. They can contain underscore ( _ ) characters but not spaces. At least one letter must be included in the variable name to distinguish it from a pure number.

Note that variable names "retain" their capitalization, but Flowcode itself it not case sensitive. If a variable is created as "MyVar", then it will be shown as "MyVar" throughout the document. Note that the variable name is changed to "FCV_MYVAR" in the actual C code, as c code is case sensitive.

Multiple variables can be created at once by creating a comma separated list in the name field. For example a,b,c will create three variables named a, b and c all with the same type and initialiser.

Initial Value

When you create a new variable you can now specify the value it has when created. Numeric values can be in decimal (unmarked) or in HEX format (preceded by 0x) or in Binary format (preceded by 0b)

e.g. 255 or 0xFF or 0b11111111.
Gen Create a New Variable Window.png

Variable Type

Select the variable type for the new variable. To see a list of the variable types and their sizes view the Variable Types article.


Arrays can be created by adding an array size attribute in square braces to the variable name. E.g. MY_ARRAY[10] creates an array called MY_ARRAY with 10 members in the array.

You can set the value of an array member in a calculation icon by using the array name with the member number in square braces. E.g.MY_ARRAY[3] = 32. Note that Arrays start at 0 i.e. an Array with 10 members will use 0-9 as the member numbers.

You can modify the array size by selecting the array in the list and editing the number in the brackets.

The only difference between an array of bytes and a string is that the string variable is available for use with the Flowcode string manipulation functions. In C code the two are identical.


Strings are arrays of BYTE ASCII character values. String arrays are composed of the array name and an array element variable. MyString[24] for instance is an array called MyString that is 24 characters in size.

Creating a string

Strings are created in the Variables screen along with other variables. To create a string enter the String array name and tick the String option. To set the array size enter the desired size inside square array brackets. If no size is specified the string will be created with the default size of 20 characters.

Video instructions

See the Adding Variables video to learn how to simply create a variable and explains the practicality of the options available.

Personal tools