Variables Use Cases
Explore the practical application of variables for various use cases. Learn how to effectively use different variable scopes and data types, predefined variables, and how these work in various triggers and responses. Experience the prototypes firsthand by trying them out and downloading them to observe the interactions.
Learn more about variables and formulas.
Find the use case you need below:
- Bunny vs. Wolf game
- Range slider
- Using data elsewhere
- Calculating the remaining balance
- Remembering what's in the shopping cart
- Timer
- On-scroll sticky header
- Enabling a keyboard view
- Using the incoming speech
Looking for formula-specific use cases? Check out the use cases involving formulas.
Find tips, tricks, and solutions about variables and formulas that other users have shared before in our communities.
Bunny vs. Wolf Game
Create variables to keep track of the score in a Bunny vs. Wolf game prototype.
Try the prototype yourself.
Learn more in the Mobile Game prototyping masterclass.
Range Slider
Link the position of the handle with a range of values. As you drag and move the handle, the latest value is stored in a variable.
Try the prototype yourself.
Learn more about the Chain trigger, Detect trigger, and functions.
Using Data Elsewhere
Store the input from the input layer in a variable, and use it elsewhere, e.g., in a different scene. Think of names, passwords, email addresses, etc., that a user would enter and you want to use throughout the prototype.
Try the prototype yourself.
Learn more about the Detect trigger, Start trigger, and layer properties.
Calculating the Remaining Balance
Calculate the remaining balance when doing a bank transfer. To do the actual calculation, use arithmetic operations subtracting the transfer amount from the current balance.
Try the prototype yourself.
Learn more arithmetic operations, conditions, and components.
Remembering What's in the Shopping Cart
Add items to the shopping cart, and calculate and display the total amount in the shopping cart dynamically—depending on what items were added.
Try the prototype (made by Soda Design) yourself.
Learn more about arithmetic operations, functions, and conditions.
Timer
After every 60 seconds, the timer adds another minute—just like any basic timer does. However, you can create any timer you like. The opposite, a countdown timer, is possible too.
Try the prototype yourself.
Learn more about the arithmetic operations, conditions, and the Detect trigger.
On-Scroll Sticky Header
Distinguish an upward and downward scroll and adjust the position of the sticky header accordingly—all using a single predefined variable: $touchVelocityY.
Try the prototype yourself.
Learn more about predefined variables and the Detect trigger.
Enabling a Keyboard View
When the keyboard appears from the bottom, move your designs based on the keyboard height. Do these calculations automatically using the predefined variable $keyboardHeight.
Try the prototype yourself.
Learn more about predefined variables and the Focus trigger.
Using the Incoming Speech
Use the incoming speech whenever listening to voice commands is enabled, using the predefined variable $voiceTranscript. Display the transcript via a Text response or make the prototype read it out loud.
Try the prototype yourself.
Learn more about predefined variables and voice prototyping.