跳到主要内容

??=

??= 是空合并复合赋值,仅当左侧为 nil 时才会赋值右侧。

let mut n = nil;
n ??= 5;
// n == 5

n ??= 10;
// n 仍然是 5