为什么 >= 有效但 =>不是? [英] Why does >= work but => not?

查看:38
本文介绍了为什么 >= 有效但 =>不是?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当检查一个整数是否等于或高于当前数字时..所以我输入

When checking if a integer is the same or above a current number.. so I type

if (5 => 6) { //Bla } 

但它显示这是一个错误.为什么?是不是和

but it shows this as a error. Why? Isn't it exactly the same as

if (5 >= 6) { //Bla } 

推荐答案

之所以不行,是因为 => 不等价于 >=.

The reason why it does not work is because => is not equivalent to >=.

=> 用于 lambda表达.喜欢:

(int x, string s) => s.Length > x

我同意这很烦人.在 lambda 表达式之前,我有时会弄错.现在我总是知道一个 (=>) 是一个 lambda 表达式,而另一个 (>=) 是 更大的大于等于符号

I do agree it is annoying. Before lambda expressions I used to get it wrong sometimes. Now I always know that one (=>) is a lambda expression and and other (>=) is the greater than equal to sign

这篇关于为什么 >= 有效但 =>不是?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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