Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Instead of:

Do:

function main() {

#variable21.show(#myVar3==1);
#variable22.show(#myVar3==1);
#variable23.show(#myVar3==1);
#variable24.show(#myVar3==1);
etc.
}

var areVarsShown=true;

function main() {
  showMyVars(#myVar3==1);
}

function showMyVars(doShow) {
  if (doShow==areVarsShown) return;   // if no change, do not execute the remaining code
    areVarsShown=doShow;                // change the value of the global variable

   #variable21.show(doShow);
   #variable22.show(doShow);
   #variable23.show(doShow);
   #variable24.show(doShow);
   etc.
}

 

...