Equality
Operations
Syntax
Operation
Description
Typing
script {
fun example() {
0 == 0; // `true`
1u128 == 2u128; // `false`
b"hello" != x"00"; // `true`
}
}module 0x42::example {
struct S has copy, drop { f: u64, s: vector<u8> }
fun always_true(): bool {
let s = S { f: 0, s: b"" };
// parens are not needed but added for clarity in this example
(copy s) == s
}
fun always_false(): bool {
let s = S { f: 0, s: b"" };
// parens are not needed but added for clarity in this example
(copy s) != s
}
}Typing with references
Restrictions
Avoid Extra Copies
Last updated
