3.4 注释

作者: 剑有偏锋 | 来源:发表于2019-11-14 16:27 被阅读0次

在 Rust 中,注释必须以两道斜杠开始,并持续到本行的结尾。对于超过一行的注释,需要在每一行前都加上 //,像这样:

// So we’re doing something complicated here, long enough that we need
// multiple lines of comments to do it! Whew! Hopefully, this comment will
// explain what’s going on.

注释也可以在放在包含代码的行的末尾:

let lucky_number = 7; // I’m feeling lucky today

注释位于它所解释的代码行的上面一行:

// I’m feeling lucky today
 let lucky_number = 7;

相关文章

网友评论

    本文标题:3.4 注释

    本文链接:https://www.haomeiwen.com/subject/tzhhyctx.html