而且还有&要不然 [英] AndAlso & OrElse

查看:73
本文介绍了而且还有&要不然的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有点偶然发现这些操作符,它们看起来很棒,因为你可以忘记第二个表达式取决于第一个表达式的结果,但使用它们有什么缺点吗?


从我的观点来看,似乎我几乎可以找到/替换我现有的代码并获得性能提升,但有些东西看起来很可疑,我真的没有看到其他人使用这些!


感谢您的任何见解!

- 迈克尔

I kinda just stumbled across these operators, they seem great, as you can forget the second expression depending on the result of the first, but are there any cons to using these?

From my viewpoint it seems I can pretty much to a find / replace on my existing code and pick up a performance boost, but something seems fishy that I really never see other people using these!

Thanks for any insight!
--Michael

推荐答案

Raterus,


完全没有后果。


只有它看起来很奇怪,大多数人都会忘记它。


Cor


我有点偶然发现这些操作符,它们看起来很棒,因为你可以

忘记第二个表达式取决于第一个表达式的结果,但是

有没有使用这些的缺点?


从我的观点来看,似乎我可以在我的

现有代码和图片上查找/替换提高了性能,但有些东西看起来很可疑

我真的没有看到其他人使用这些了!
Raterus,

No consequences at all.

Only it looks so strange that most people forget it.

Cor

I kinda just stumbled across these operators, they seem great, as you can
forget the second expression depending on the result of the first, but are
there any cons to using these?

From my viewpoint it seems I can pretty much to a find / replace on my
existing code and pick up a performance boost, but something seems fishy
that I really never see other people using these!


我的两分钱 - 我认为他们是伟大的运营商,我一直都在使用它们。

和你一样,我偶然发现它们,起初有点谨慎。我相信人们不会使用它们因为他们真的不知道它们存在。

Raterus < RA ***** @ spam.org>在留言中写道

新闻:%2 **************** @ TK2MSFTNGP11.phx.gbl ...

我有点儿只是偶然发现了这些操作符,它们看起来很棒,因为你可以根据第一个结果忘记第二个表达式,但是

有没有使用它们的缺点?


从我的观点来看,似乎我可以在我的

现有代码中找到/替换并获得性能提升,但有些东西似乎很可疑

我真的没有看到其他人使用这些!


感谢您的任何见解!

- 迈克尔

My two cents - I think they are great operators and I use them all the time.
Like yourself, I stumbled upon them, and was a little cautious at first. I
believe people don''t use them because they don''t really know they exist.
"Raterus" <ra*****@spam.org> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
I kinda just stumbled across these operators, they seem great, as you can
forget the second expression depending on the result of the first, but are
there any cons to using these?

From my viewpoint it seems I can pretty much to a find / replace on my
existing code and pick up a performance boost, but something seems fishy
that I really never see other people using these!

Thanks for any insight!
--Michael


如果你的IF语句中的逻辑依赖于所有条件

正在测试,那就是con。


-Carl

" Raterus" < RA ***** @ spam.org>在留言中写道

新闻:%2 **************** @ TK2MSFTNGP11.phx.gbl ...

我有点儿只是偶然发现了这些操作符,它们看起来很棒,因为你可以根据第一个结果忘记第二个表达式,但是

有没有使用它们的缺点?


从我的观点来看,似乎我可以在我的

现有代码中找到/替换并获得性能提升,但有些东西似乎很可疑

我真的没有看到其他人使用这些!


感谢您的任何见解!

- 迈克尔

The con is if the logic in your IF statement depends on all the conditions
being tested.

-Carl
"Raterus" <ra*****@spam.org> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
I kinda just stumbled across these operators, they seem great, as you can
forget the second expression depending on the result of the first, but are
there any cons to using these?

From my viewpoint it seems I can pretty much to a find / replace on my
existing code and pick up a performance boost, but something seems fishy
that I really never see other people using these!

Thanks for any insight!
--Michael


这篇关于而且还有&amp;要不然的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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