Variables / Data Types
Smowcode supports various ways for you to send data between nodes in your project.
The following topics discuss how:
Node Properties (i/p)
Node properties act as inputs of the node and can be assigned a constant value, variable or an expression. Based on the property type, it should either be assigned a number, a string or an expression that results a number/text.
Double-click a node to open its node properties.
Output Variables (o/p)
Output Variables hold output data of the node are assigned internally by the node. Per output bubble there can be multiple output variables. You can change name of the variable to which the output value will be assigned by the node.
Double-click a node to view its Outputs section below its node properties.
Constants
You can assign a constant value to a node property by specifying the number of text directly.
Datatypes (automatic)
You can use data of the basic types Number, Text or Array.
- Numbers can be integers or float, signed or unsigned, single byte(uint8) or multibyte (2/4/8 bytes) eg.
123
,0.123
,1234.5678
,-1234.56
,1234567890
. - A Text can be a sequence of alphanumeric characters (ASCII format) in double quotes eg.
"my string"
,"raj@website.com"
. - Arrays are contigual sequence of data. You can create them using a
create array
node and access it usingarray_name[index]
.
Arrays
Arrays can be of the basic data types (Number/Text) or the advanced data types where you can choose a number's type, size and signedness:
int8
int16
int32
int64
uint8
uint16
uint32
uint64
float
.
You can use arrays while assigning it to config properties and in expressions or assigning it from an output variable.
Array Nodes
array push
- Push a new element to the array.array remove
- Remove an element from the array.array length
- Get length of the array.
Variables
Smowcode supports 2 types of variables, Flow and Global.
Flow Variables
Flow variables get created on the go by specifying names in the output vars section of nodes. They can be assigned to the node properties of all connected next nodes.
Valid Code
It's a valid code because the variable gets created before the use of the variable in the next node.
Invalid Code
It's an invalid code because the variable gets created in a parallel branch which isn't before the use of the variable.
Global Variables
Global Variables can be used throughout the flows. A variable may be assigned in 1 flow and used in another.
- Make a variable global by declaring it in the Globals section inside right sidebar's top right menu arrow (immediately below Smowcode's main menu).
- All global variables are thread safe.
File level Globals
Globals can be file based. They will only be accessible withing the file. While declaring the global, select F
type.
Project ('G') level Globals
Global variables will be accessible throughout each file of the project. While declaring the global, select G
type.
Project level Globals will get declared in the project file and not the .smow file.
:::
Garbage Collection
Smowcode supports automatic garbage collection. Local variables are deleted automatically once they go out of scope.