I have a bunch of variables having boolean values. I wish to have another variable that stores the name of the boolean variable changed last. So, next time when a new boolean variable value is changed, I want to toggle the previous boolean variable.
Any idea/suggestion to achieve the above would be highly appreciated.
Eg. it would be something like this incorrect code-
isDemo1=false; isDemo2=false; isDemo3=true; isDemo4=false; isDemo5=false;
lastChangedBooleanVariable = this.isDemo3;
handleBooleanVaiables(currentChangedBooleanVariable: string)
{
// somehow toggle this.isDemo3 variable value
this.lastChangedBooleanVariable = currentChangedBooleanVariable;
// let's say currentChangedBooleanVariable = isDemo4
// somehow toggle this.isDemo4 value
}