<sidebar>Sidebar: Flowcode Help Overview:Variables</sidebar>
A variable type defines what can be represented by that variable, as well as the ammount of storage the variable will take up.
Signed integers can be positive or negative, but there is no fractional part. They are typically used in maths or graphical areas, but not so much when dealing with individual bits.
Unsigned integers can only be positive. Unsigned integers will double the range of a variable if it is known the value can never be negative. Unsigned integers are useful for bit-masking and other logical operations, but are not usually used in mathematical operations as these will usually require a signed value.
|Range:||0 or 1|
|Bit Depth:||1-bit unsigned integer|
A Boolean value is either true or false. In Flowcode, this means 1 or 0, respectively. On download, this may take up 1 byte or a single bit, depending on the compiler.
Boolean values are used typically to set flags. Though internally a BOOL is stored as an integer, it is considered bad practice to mix Boolean values and integers in expressions.
|Range:||0 to 255|
|Bit Depth:||8-bit unsigned integer|
A byte is the smallest storage unit most processors are able to read from in a single instruction. A byte can be used to store a single value or its bits may be used as flags, almost like a compact array of BOOLs.
|Range:||-32768 to 32767|
|Bit Depth:||16-bit signed integer|
|Range:||0 to 65535|
|Bit Depth:||16-bit unsigned integer|
|Range:||-21474836648 to 21474836647|
|Bit Depth:||32-bit signed integer|
A 32-bit integer is useful for processing larger values and most integer-arithmetic uses found in embedded devices.
|Range:||0 to 4294967295|
|Bit Depth:||32-bit unsigned integer|
An unsigned 32-bit value offers the largest integer value of any of the types, and because of this, many of the simulation-only functions in Flowcode use ULONG, because simulation memory is not a consideration.
A floating point value can represent a much wider range of values than an integer can, but at a loss of accuracy over large ranges. Floating point values when downloaded will be 64-bit if the target supports them, or 32-bit if it does not.
|Range:||-Infinite to +Infinite|
|Bit Depth:||32-bit signed|
Flowcode also supports some structured types to help with programs.
|Range:||0 to 255 per character|
|Bit Depth:||8-bit unsigned array. Default size of the array is 20.|
A string is a byte-array used to store text. Hence in many circumstances a string and a byte array are interchangeable.
One important difference is in Flowcode strings terminate at a null (0x00) character. This means the first zero-value byte that is encountered in the string marks the end of the string. If a string contains the exact number of characters specified in the declaration it will not contain a terminating zero, in all other cases it will.
|Bit Depth:||32-bit unsigned value|
An object handle is used to reference a more complicated piece of data (such as a file, Flowcode component or block of text) whose internal format is not known. Flowcode provides many simulation macros that use handles to easily pass data around.
In an embedded context, a handle can be thought of as a pointer to memory, except Flowcode manages the handles so referencing a non-existent handle will not cause any fatal errors.
A handle value of zero is considered null and invalid to Flowcode.