rust-quiz:001-macro-count-statements.rs
rust-quiz:002-bitand-or-reference.rs
rust-quiz:003-mutate-const.rs
rust-quiz:004-dotdot-in-tuple.rs
rust-quiz:005-trait-resolution-hrtb.rs
rust-quiz:006-value-of-assignment.rs
rust-quiz:007-surprise-wildcard-match.rs
rust-quiz:008-tokenize-punctuation.rs
rust-quiz:009-opaque-metavariable.rs
rust-quiz:010-shadowed-trait-object-method.rs
rust-quiz:011-function-pointer-comparison.rs
rust-quiz:012-binding-drop-behavior.rs
rust-quiz:013-mutable-zst.rs
rust-quiz:014-trait-autoref.rs
rust-quiz:015-inference-of-number-type.rs
rust-quiz:016-prefix-decrement.rs
rust-quiz:017-unary-decrement.rs
rust-quiz:018-method-or-function-pointer.rs
rust-quiz:019-dropped-by-underscore.rs
rust-quiz:020-break-return-in-condition.rs
rust-quiz:021-closure-or-logical-or.rs
rust-quiz:022-macro-tokenize-number.rs
rust-quiz:023-inherent-vs-trait-method.md
rust-quiz:024-local-and-const-hygiene.rs
rust-quiz:025-unit-infallible-match.rs
rust-quiz:026-iterator-lazy-map.rs
rust-quiz:027-subtrait-dispatch.rs
rust-quiz:028-underscore-prefix.rs
rust-quiz:029-tuple-trailing-commas.rs
rust-quiz:030-clone-pointers.rs
rust-quiz:031-method-lookup.rs
rust-quiz:032-or-pattern-guard.rs
rust-quiz:033-range-full-method.rs
fn main() {
let mut a = 5;
let mut b = 3;
print!("{}", a-- - --b);
}
rust
沒有++
和--
,都會被拆解為+
和-
。
a-- - --b
=> a-(-(-(-(-b))))
=> a - b
很簡單,有五個-
,兩兩抵消,最後結果就是相減,結果為2
2
本作品採用《CC 協議》,轉載必須註明作者和本文連結