📜  什么是统一的百分号 c# 代码示例

📅  最后修改于: 2022-03-11 14:48:59.539000             🧑  作者: Mango

代码示例1
/*% is the modulus operator.
It returns the remainder after division.
For example, 5 / 3 is 1 with a remainder of 2.
The modulus operator will return 2.*/

//Here is a example of the modulus operator.
 index = (0 + 1) % 3 = 1 % 3 = 1  // 1 divided by 3 is 0 with a remainder of 1 so index is now 1
 index = (1 + 1) % 3 = 2 % 3 = 2  // 2 divided by 3 is 0 with a remainder of 2 so index is now 2
 index = (2 + 1) % 3 = 3 % 3 = 0  // 3 divided by 3 is 1 with a remainder of 0 so index is now 0.

//This info is from https://answers.unity.com/questions/1164131/percentage-sign.html