But if I did have two lines of code or more, I would in fact need to put those back.
但是如果我的确有两行或更多的代码,我其实应该把花括号加上。
I want the function, which is a little tool, a line of code I can include in my own programs and generally those tools live in sections two or three of the manual.
我想要一个函数,那是一个小工具,在我程序中可以包含的一行代码,通常这些工具在手册的第二节,或第三节。
Honor to so many of us sounds quaint, like an honor code or the Boy Scouts' code or something like that or something primitive, some kind of primitive ethic which we therefore don't really understand.
荣誉,对我们中大多数而言,听起来都会很奇怪,这就像是在说荣誉代码,童子军守则或一些类似的东西一样,亦或是一些非常原始的理论,以致于我们根本不知道这是在说什么。
So when you're writing a program in this language and many others, if you wanna make a comment to yourself or for other people who are reading this with their TF or fellow colleagues, you use what are called comments.
当你用这样那样的语言写程序时,为了便于自己或他人,阅读我们写的代码,我们必须得做一些注解,这就是所谓的注释。
You can say if this is true, then go and do the following pieces of code or puzzle pieces that are inside this part of the block, else go ahead and do these that are down here.
你可以说如果条件成立,执行下面的代码段,或板块中的拼图,否则跳过去执行这下面的语句。
The curly braces to encapsulate one or more lines of code.
花括号压缩了一行或多行代码。
The idea of a "code walkthrough" refers to the process of walking through your code verbally or visually with or without other people.
代码走查“的概念是单独或者和别人一起,通过查看或讨论学习你们的代码,的一个过程。
It takes an int; deal with it when you get to it and then once you look through the whole file, should you find -- ultimately find the actual code that defines or impliments this thing.
它携带一个int数,当你获得了它就处理它,然后一旦你查看整个文件,最终你将发现实际代码中,定义或执行了这个东西。
So that is a flag that tells the compiler that I want to use or link into my own program code that someone else wrote that lives somewhere else on the system whose moniker is CS50.
所以那是一个标记,用来告诉编译器我想使用,或连接我自己的程序代码到一个叫做CS50的系统中的程序,可能其他人在那个系统写了这些程序。
So don't underestimate the value for the next week or two of just inserting printf statements into your code temporarily just to print out what the value of some variable is, or some expression is, so that you can just do a sanity check.
所以不要低估下一两周的重要性,虽然我们只将“printf“语句暂时地植入到,我们的代码中,只是用来打印一些,变量或表达式的值,所以你们提醒一下自己。
You can stack these things in C. So if you want to do if - and then rather -- let me tweak this just so simplify -- if you want to stack these things and do this in one case or that in the other, can you stack them like this?
你们才可以在C语言中使用这些东西,所以如果你想做,-让我把这个弄得更简单点-,如果你想把这些代码堆集在一起,在一个情况中,或在另一个情况中处理,你能够像这样把他们集在一起吗?
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,术语中叫做,一句代码,你就不需要使用花括号了;,如果那个条件成立,你有两行或更多行的代码时需要执行时,你就需要花括号。
- So now if Christiana doesn't actually -- if either programmer or who's programming these little puzzle pieces, don't actually do anything with this return value, and I call, get int, she wants to hand this piece of paper -- to me, but if I don't actually assign -- no, no, I just messed up the demo.
现在如果Christiana没有-,如果程序员或谁在编写这段代码,不要对这个返回值做任何事情,我调用GetInt,她把这张纸给我,但是如果我没有赋值-,不,不,我刚才把这个演示搞乱了。
应用推荐