So in general, when you're running command line programs, they can take input or arguments or parameters or switches or flags.
一般而言,当你运行命令行程序时,可以把把这些当做输入,像什么参数啊,或开关啊,或标志啊等等。
What I don't want your program to do is crash when that happens. Or run forever.
当这种问题出现时程序崩溃,或者一直运行下去。
And so when I run this program, nothing all that interesting happens.
所以当我运行这个程序,没有什么会发生。
Always guess before you run your program what you think it's going to do.
当你运行程序之前,总是先想想程序会怎么做。
It's a little puzzle piece that says when the green flag is clicked and this is kind ; of like the beginning of a program; when you double click an icon on your desktop this is how something like that is implemented; it's listening for that double click, it's listening for that green flag.
是一小个按钮,它的意思是,何时点击绿色旗帜,这就好比开始运行程序;,当你双击桌面上的图标,就开始执行操作,桌面的图标需要双击,绿色小旗也等待点击来执行命令。
And when I ran that it, I got weird results, 300 because we know that a Google priced at, say, 300, is much more likely to move by 10 points in a day than a stock that's priced at $0.50.
当运行这个程序的时我得到很奇怪的答案,因为我们知道一只谷歌的股价大概是,对一个0。5美元的股票来讲,每天改变10个点才比较正常。
But that little short hand there is doing exactly the same thing. It is adding that value into some digits and putting it back or signing it back into some digits. And I'll walk through that loop and when I'm done I can print out the total thing does. And if I do that, I get out what I would expect.
加上得到的这个数的,但是这个缩写声明其实是进行了同样的操作,它把我们得到的这个数加到一个数上面去,然后用和对这个数进行了重新赋值,在循环中会去遍历字符串,当完成循环后,程序会显示数字的总和,如果我运行,这个程序的话,我会得到我期待的结果。
This code does swap the two values, A and B. However, when I run this program, something happens.
这个代码没有交换那两个值,A和B,但是,当我运行这个程序时,有些事情发生了。
应用推荐