You can put a variable there, and because it's not encapsulated in curly braces, as we just discussed, that essentially means it's accessible everywhere in that file.
你可以加入一个变量,因为它不是封装在花括号里,就像我们刚才讨论的,本质的意思是它可以在文件的所有地方,都可以被访问到。
So the system will not be described by a single state variable during the path.
因此系统将不能被,路径上的单一状态变量描述。
And obviously, that ought to involve the variable in some way, or it's not going to make a lot of sense, so this includes the variable, since that's the thing that's changing.
很明显,这跟计数器的变量有某种关系,否则的话就没多大意义了,因此这跟计数器有关,因为它正是每次循环改变的东西。
If you're not updating some variable by incrementing it or decrementing it -- if you're not changing anything, presumably the conditions are never going to evaluate to false or the opposite, so you're just going to have an infinite loop, which might be your goal, but odds are it's not.
如果你不通过增加或减少它来改变一些变量,-如果你不改变什么,大概那个条件永远不会变成错误的,或相反的,所以你将得到一个无限循环,那可能是你的目标,但可能也不是。
Sometime later, I will deal with functions of more than one variable, which I will briefly introduce to you, because that may not be a prerequisite but certainly something you will learn and you may use on and off.
再过段时间,我要开始处理多变量函数,到时候我会向你们进行简单介绍,因为那不是必须的,但是你们以后会学到,有时候还能派上用场
Because I was taught good style, I'm giving that variable a name that conjures up the idea of its role, which is thankful or not.
因为我们学习了好的格式风格,我将给那个变量起一个,能使我们联想到它的角色作用,它是满意的或不满意的。
And when I'm done with the whole thing, before I end the increment of the variable, you know, when I'm done, I'm just not returning anything out.
在循环外面初始化它,然后做一个终结测试,然后在循环内部有一个指令集,在这个例子中,就是对余数做检查,然后显示信息,当我完成了整个循环。
Right, so the fact that everything is indented means while 2 we're doing, while the variable is not equal to 2, keep doing this.
事实上缩进意味着,如果变量不等于,就重复我们现在所做的这个过程。
Right.? I'm going to set up a variable to say, none what's the answer I want to return, is it there or not. Initially it's got that funny value none.
看我要找的答案在不在数组里面,初始化为,然后建立一个索引。
D-A-V-I-D I'm not hardcoding in D-A-V-I-D anymore but I can still use a variable.
我不再把名字写死为,而是用一个变量来代替。
I have not checked the length of the variable called nan.
没有检查变量的长度。
It's not a local variable.
它不是一个局部变量。
And remind you that inside of here, I'd better be changing the variable. All right, if that variable that's counting is not changing I'm going to be stuck in an infinite loop, so I ought to that, right, expect somewhere in there, a change of that variable. All right?
我最好改变了计数器的变量值,好,如果计数的变量没有变化的话,我就会被卡在一个无限循环里面,因此我应该【不可闻的声音】,对,在这里的某个地方,改变下计数器的变量,对不对?我要做的最后一件事情就是?
I declare a variable called n. I'm not giving it a value yet, so I had better be careful.
我申明一个变量n,我先不给它赋值,所以我最好小心点。
And the thing I wanted point out is, we've got this global variable number of calls. Which is there not because Fibonacci needs it but just for pedagogical reasons, so that we can keep track of how much work this thing is doing.
要指出的是我们已经,调用了几次这个全局变量,这不是因为斐波那契数列,需要调用它而只是,因为教学上的需要,以便我们可以知道,这个函数做了多少事情。
So I start this program by declaring as I did before a global variable X. It is global simply because it is not inside any of my functions.
在程序的开始,我声明,一个全局变量X,它是一个全局的,因为它不在任何一个函数里面。
Once I've got that, I can now start giving some variable names, sorry not, rephrase that, I can give some attributes, I can give some characteristics to these classes.
还有个指向内存中地址的指针,我还可以命名这个指针,因此cp1和cp2都是,指向它们的指针,一旦我创建了它类,我就可以开始赋予。
But that table does not affect any bindings for other instances of the variable like x for ANS.
这时这个局部表就消失了,这个局部表将不会影响其它赋值,比方说像ANS对应的x变量。
应用推荐