更新时间:2023-02-22 15:07:09
x--
将为4,但在--x
时刻将为3,因此最终将为2,那么您将拥有>
x--
will be 4, but will be 3 at the moment of --x
, so it will end being 2, then you'll have
x = 4 - 2
顺便说一句,您的第一种情况是x = 4 + 6
btw, your first case will be x = 4 + 6
这是一个小示例,它将打印出每个零件的值,也许这样您会更好地理解它:
Here is a small example that will print out the values for each part, maybe this way you'll understand it better:
static void Main(string[] args)
{
int x = 4;
Console.WriteLine("x++: {0}", x++); //after this statement x = 5
Console.WriteLine("++x: {0}", ++x);
int y = 4;
Console.WriteLine("y--: {0}", y--); //after this statement y = 3
Console.WriteLine("--y: {0}", --y);
Console.ReadKey();
}
这将打印出来
x++: 4
++x: 6
y--: 4
--y: 2