Remove a global variable
Function: Remove a global variable
This action allows you to clear out a piece of information that your application has stored for temporary use. Think of it like erasing a note from a shared whiteboard that everyone in your application can see. Once removed, this information is no longer available for other parts of your application to use. This is useful for cleaning up temporary data or resetting states.
Input,
- Variable name (STRING, required): This is the unique label or name you gave to the piece of information you want to remove. You need to provide the exact name so the system knows which specific variable to clear.
Output,
This action does not produce any direct output. Its effect is the removal of the specified global variable from your application's memory.
Execution Flow,
Real-Life Examples,
-
Clearing a temporary search query:
- Scenario: After a user performs a search on a product catalog and then navigates away from the search results, you might want to clear the stored search term to ensure the next search starts fresh.
- Inputs:
- Variable name:
CurrentSearchQuery
- Variable name:
- Result: The
CurrentSearchQueryvariable is removed from the application's memory, so if the user returns to the search page, the previous query won't be pre-filled.
-
Resetting a "New User" flag:
- Scenario: When a new user first logs in, you might set a global variable like
IsNewUsertoTrueto show them a welcome tour. After the tour is completed, you'd want to remove this flag so they don't see the tour again on subsequent visits. - Inputs:
- Variable name:
IsNewUser
- Variable name:
- Result: The
IsNewUservariable is removed, indicating that the user is no longer considered "new" for the purpose of showing the welcome tour.
- Scenario: When a new user first logs in, you might set a global variable like
-
Discarding an incomplete form's data:
- Scenario: A user starts filling out a multi-step form, and the data for each step is temporarily stored in a global variable (e.g.,
FormDataStep1). If the user decides to cancel the form, you'd want to remove all the partially entered data. - Inputs:
- Variable name:
FormDataStep1
- Variable name:
- Result: The
FormDataStep1variable, containing the user's partial input, is cleared from the application's state, preventing it from being accidentally used or submitted later.
- Scenario: A user starts filling out a multi-step form, and the data for each step is temporarily stored in a global variable (e.g.,