• So let me challenge you with this: inside of these curly braces where I have put a comment with slash slash -- a "comment" means nothing here gets compiled, it's just for the human to read.

    让我用这个来挑战你们:,在这些花括号里面,我通过双斜杠写入了一个注释,-一条“注释“在这里不会被编译,它只是用来我们阅读的。

    哈佛公开课 - 计算机科学课程节选

  • So when you define a function, you have, as we've seen these curly braces, that define all ; of the code that's associated with that function; open curly brace code, close curly brace, that is the function.

    当你定义一个函数,就像我们看到的这些花括号,定义了与,那个函数相关的所有代码;,左花括号,代码,右花括号,这就是一个函数。

    哈佛公开课 - 计算机科学课程节选

  • So we have if, and that is followed by, I'm going to use angle braces here just to indicates something goes in here, some test followed by a colon.

    那么我写了if,后面跟着,我这里会用一个角括号,来代表这里有些东西,冒号后面跟着一些测试。

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • And so what I was hinting at earlier when you put semicolons in the wrong place, and then proceed to have curly braces around arbitrary lines of code, you're creating an even more local scope there, which is generally not the right intended behavior.

    在之前我暗示了,当你把一个分号放在错误的地方时,然后开始用花括号,括上任意行的代码,你在那里创建了一个局部范围,那个不是故意的行为。

    哈佛公开课 - 计算机科学课程节选

  • So I actually don't need the curly braces because I only have a single line of code.

    所以我实际上不需要那个花括号,因为我只有一行代码。

    哈佛公开课 - 计算机科学课程节选

  • And then there are some stupid syntax like curly braces and semicolons that initially are kind of annoying because you have to remember where all this junk goes.

    还有一些像大括号和,分号之类的愚蠢语法,最初是很讨厌的,因为你需要记得它得放到哪里。

    哈佛公开课 - 计算机科学课程节选

  • So if you do include it up top, the subsequent lines, even if you have these curly braces, are not, in fact, going to help you.

    所以如果你在前面就包含它,后面的代码,即使你有这些花括号,实际上也没有用了。

    哈佛公开课 - 计算机科学课程节选

  • Well, for a thing called main which itself is a function but a function I wrote, a tool I am writing at the moment not like printf which someone else wrote long ago, I have to say where does main start, where does main end, and I do that by using these curly braces.

    至于这个名曰main的函数,由我们自己写的函数,也是一个工具,只不过由我们自己编写,而不是像printf那样已经由前人写好了,我们必须要说明main在哪开始,在哪结束,这样我们就要用到大括号了。

    哈佛公开课 - 计算机科学课程节选

  • As an aside, if you ever just have one line of code that you want to execute, one puzzle piece in Scratch terminology, ; you actually don't need the curly braces; you only need the curly braces if you have two or more lines of code that you want to execute if that condition is true.

    此外,如果你只有一行代码,需要执行,在Scratch,术语中叫做,一句代码,你就不需要使用花括号了;,如果那个条件成立,你有两行或更多行的代码时需要执行时,你就需要花括号。

    哈佛公开课 - 计算机科学课程节选

$firstVoiceSent
- 来自原声例句
小调查
请问您想要如何调整此模块?

感谢您的反馈,我们会尽快进行适当修改!
进来说说原因吧 确定
小调查
请问您想要如何调整此模块?

感谢您的反馈,我们会尽快进行适当修改!
进来说说原因吧 确定