什么是与++ i我之间的区别++? [英] What is the difference between i++ and ++i?

查看:133
本文介绍了什么是与++ 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆