什么是与++ i我之间的区别++? [英] What is the difference between i++ and ++i?
问题描述
我看过他们在无数个C#code两个被使用,我想知道何时使用我++
或 ++我
( I
是一个数字变量如 INT
,浮动
,双击
等)。谁知道这个?
I've seen them both being used in numerous pieces of C# code, and I'd like to know when to use i++
or ++i
(i
being a number variable like int
, float
, double
, etc). Anyone who knows this?
推荐答案
奇怪,它看起来像其他两个答案不拼出来,这绝对是值得一说的:
我++
意思是'告诉我 i的值
,然后增加
i++
means 'tell me the value of i
, then increment'
++我
办法增量 I
,然后告诉我的价值
++i
means 'increment i
, then tell me the value'
他们是pre递增,递增后的运营商。 在这两种情况下,变量被递增的,但是,如果你要采取两个前pressions的值完全相同的情况下,结果将是不同的。
They are Pre-increment, post-increment operators. In both cases the variable is incremented, but if you were to take the value of both expressions in exactly the same cases, the result will differ.
这篇关于什么是与++ i我之间的区别++?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!