I'm looking to click a button and run a bunch of lines of code and at the end update my variable so when I click the button the second time it runs some different lines of code. I tried this, but it's complaining about redeclaring the variable. What's the cleanest way to do a simple toggle where the state changes each time you run it?
int $uvToggleChecker = 1; if ($uvToggleChecker == 1) print "UV checker map turned on.";
if ($uvToggleChecker == 0) print "UV checker map turned off."; int $uvToggleChecker = 0;
Replies
Why do this instead of:
> $uvToggleChecker = 0;
or just
> $uvToggleChecker = !$uvToggleChecker;
int $uvToggleChecker = !$uvToggleChecker;
if ($uvToggleChecker == 1)
print "UV checker map turned on.";
if ($uvToggleChecker == 0)
print "UV checker map turned off.";