In this tutorial, we will learn how to declare and use variables in the Raptor flowchart. We need variables to store data and retrieve data used in the flowchart.
What is a Raptor variable?
Computer programs store data in memory. A variable is a name that points to the memory location where we store data. The data value stored in the variables has a datatype. In the Raptor flowchart, we have Numbers, Strings and Arrays.
i and name are variables that hold Number and String data values respectively.
Raptor variables are automatically created when we first use them in the flowchart. For example, when we use the Input symbol to store the data entered by the user.
We can assign values to a variable using the Assignment flowchart symbol. During the flowchart run, the values that are stored in a variable may change based on the flowchart logic.
name <- “Emma”
Naming variable names
Raptor variables should start with an alphabet letter and can only contain letters, digits, and underscore. It’s recommended to keep the variable names clear, meaningful, and descriptive. Programmers should also stick to a naming convention for naming the variable’s names.
|use of underscore||employee_name|
Some invalid variable names are shown below:
|1||Variable names cannot start with digits.||7rate|
|2||Variable names cannot contain illegal characters.||Student$Name|
|3||Variable names cannot empty spaces.||interest rate|
Raptor Tutorials on this website can be found at:
RAPTOR official website: https://raptor.martincarlisle.com/