I know this is a very basic question (I'm relatively new to C#), but somehow I can't find anything about it on the internet.
I just would like to understand what the "%" operator does, I've seen applications before and have a slight idea but am not 100% sure what exactly it does.
For example, here is a method that is executed every 10 frames (in Unity):
void Update() {
frames++;
if (frames % 10 == 0) {
// method
}
}
And here is a game time calculation that is displayed:
// time = incremented by 1 every second
int seconds = (time % 60);
int minutes = (time / 60) % 60;
int hours = (time / 3600) % 24;
// int days = (time / 86400) % 365;
What exactly does the % operator do in these examples and how can I best understand it.