We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
✅
fn main() { let f = false; }
❌
fn main() { let f = false let f: bool = true; }
但是,如果你的语句是函数体的最后一行,可以省略分号。
fn main() { let f = false; let f: bool = true; println!("f is: {}, f2 is: {}", f, f2) }
fn main() { let f = false; let f: bool = true; t() } fn t() { let f = false; let f: bool = true println!("f is: {}, f2 is: {}", f, f2) }
表达式的结尾没有分号。如果在表达式的结尾加上分号,它就变成了语句,而语句不会返回值。
The text was updated successfully, but these errors were encountered:
No branches or pull requests
在 Rust 中必须以分号结束?
✅
❌
但是,如果你的语句是函数体的最后一行,可以省略分号。
✅
✅
表达式的结尾没有分号。如果在表达式的结尾加上分号,它就变成了语句,而语句不会返回值。
The text was updated successfully, but these errors were encountered: