I am working with several boolean variables and I want to create a new variable that keeps track of the most recently changed boolean variable. This way, every time a new boolean variable is modified, I can toggle the previous one.
If you have any ideas or suggestions on how to accomplish this task, please share them!
Here's an example of what I'm trying to achieve, albeit with incorrect code:
isDemo1=false; isDemo2=false; isDemo3=true; isDemo4=false; isDemo5=false;
lastChangedBooleanVariable = this.isDemo3;
handleBooleanVaiables(currentChangedBooleanVariable: string)
{
// Toggle the currentChangedBooleanVariable
this.lastChangedBooleanVariable = currentChangedBooleanVariable;
// For instance, if currentChangedBooleanVariable = isDemo4
// Toggle the value of this.isDemo4
}