is there an extension that lets you add a percentage of a variable too something?
1 Like
what do you mean cause we can do myVariable + myVariable2 - 5
1 Like
Change variable by (num)/(num2)
1 Like
I mean like really specifically: change variable by -10x 20% of variable
1 Like
that would just change by a fixed amount
1 Like
-10 * 20% is -2 so you just need something like:
variable -= 2 * otherVariable.
“Percent” is just multiplying by (%) / 100, so if I wanted, say, 45% of a variable I could multiply it by 45 / 100. 45 / 100 is 0.45, and if you can see that pattern you can see that 20% of something is multiplying it by 0.2.
Keep in mind that “%” in programming is actually the mod symbol, which finds the remainder of a division.
1 Like