代码点读机 / Rust / >

> Rust · 运算符

大于比较运算符,左边大于右边返回 true。

怎么用

a > b,用于大于比较

小例子

println!("{}", 2 > 1);

运行结果

true

提醒:和数学里一样;不能连写如 1 < x < 3

官方文档:https://doc.rust-lang.org/reference/expressions/operator-expr.html#comparison-operators

在代码里遇到不认识的词?打开代码点读机,点一下就懂 → ← Rust全部词条