Create a number
Function: Create a number
This action allows you to create a new variable in your application's memory that stores a whole number. You can then use this variable in other actions, calculations, or to display information to your users. It's perfect for keeping track of quantities, scores, counts, or any other numerical data within your application's logic.
Input
- Value (Type: NUMBER) The specific whole number you want to store in your new variable. This is the actual numerical data that the variable will hold.
- Variable name (Type: STRING)
The unique name you want to give to this new number variable. This name acts as an identifier, allowing you to easily reference and use the variable in other parts of your application. For example, you might name it
totalItems,userScore, orproductQuantity.
Output
- New Number Variable
A new variable is created in your application's memory. It will hold the
NUMBERvalue you provided and can be referenced by theVariable nameyou specified. This variable is now available for use in subsequent actions within your application flow.
Execution Flow
Real-Life Examples
Here are some practical ways you can use the "Create a number" action in your no-code application:
Example 1: Tracking a Shopping Cart Total
Imagine you're building an e-commerce application and want to keep a running total of items in a user's cart.
- Inputs:
- Value:
0 - Variable name:
cartItemCount
- Value:
- Result: A new variable named
cartItemCountis created, holding the number0. You can then increment this variable each time a user adds an item to their cart.
Example 2: Setting a Default Discount Percentage
For a promotional campaign, you might want to define a standard discount that can be applied to products.
- Inputs:
- Value:
15 - Variable name:
defaultDiscount
- Value:
- Result: A new variable named
defaultDiscountis created, holding the number15. This variable can then be used in calculations to apply a 15% discount.
Example 3: Initializing a Game Score
In a simple game application, you need to start a player's score at zero.
- Inputs:
- Value:
0 - Variable name:
playerScore
- Value:
- Result: A new variable named
playerScoreis created, holding the number0. As the player earns points, you can update this variable using other actions.