Create a double
Function: Create a double
This action allows you to create a new variable in your application's memory to store a decimal number (a "double"). This is useful for holding numerical values that might have fractions, like prices, measurements, or calculated results. Once created, you can use this variable in other parts of your application.
Input
- Value (Type:
DOUBLE): The decimal number you want to store in the new variable.
Output
- Variable name (Type:
STRING): The name of the variable to store in the variable scope. This is the identifier you will use to refer to this number later in your application.
Execution Flow
Real-Life Examples
Here are some practical ways you can use the "Create a double" action:
-
Storing a Product Price:
- Inputs:
Value:99.99
- Result: A new variable is created in your application's memory, holding the value
99.99. The action outputs the name of this new variable, for example, "productPrice". You can then use "productPrice" in calculations or to display on a page.
- Inputs:
-
Calculating and Storing an Average Score:
- Inputs:
Value:\(Total_Score / Number_of_Students\)(e.g., ifTotal_Scoreis 850 andNumber_of_Studentsis 10, the value would be85.0)
- Result: A new variable is created, storing the calculated average score (e.g.,
85.0). The action outputs the name of this new variable, for example, "averageExamScore". This variable can be used to compare student performance.
- Inputs:
-
Recording a Temperature Reading from a Sensor:
- Inputs:
Value:\(Sensor_Data.currentTemperature\)(e.g., if a sensor provides23.7degrees Celsius)
- Result: A new variable is created, holding the temperature reading (e.g.,
23.7). The action outputs the name of this new variable, for example, "roomTemperature". This variable can be displayed on a dashboard or used in automation rules.
- Inputs: