I have a variable that ranges from 0-100. I have one script that depends upon the 10’s place (it cares whether the variable is between 10-19, 20-29, etc) and another one that cares about the one’s place (1, 11, 21, 31 would all return the same value, as would 2, 12, 22, etc).
It’s fairly easy to get the 10’s place. (I think I can just divide by 10, then round to the nearest integer) but I’m not sure how to get the one’s place. Anyone know the best way to do that?
15 % 10 = 5
25 % 10 = 5
11 % 10 = 1
etc. 
While I’m sure what you’re saying is pretty simple, I’m not quite getting what you mean and how to turn it into code.
% is the modulo operator. You use it like other operators in your code (+, -, *, /, etc.)
It returns the remainder after performing division.
X % A returns the remainder of X / A
So 5 % 2, for example, returns 1 (5 / 2 = 2, remainder 1); 133 % 10 returns 3 (133 / 10 = 13, remainder 3).
What you need is the remainder after dividing by 10, so just do
ones = your_value % 10;
Ah. Thanks!
Part of my problem is that the Unity docs don’t really explain programming from the ground up. They make it really easy to do certain cool things, but a lot of basic stuff I have to keep searching around for. And most of the resources that I can find for Javascript itself are either very dry and hard to read, or dumbed down for beginners to the point where most of the stuff is really basic.