And I'm going to run it in a sec, but you can see, the same kind of idea.
我马上要去运行它,但是你们会明白,思想是一样的。
Yeah, I was homeless but I wasn't hopeless, okay?
是,我无家可归,但是我不绝望,明白?
All right. So it's fun, and I got a little bit of applause out of it, which is always nice for me, but I also showed you how to think about it recursively.
好,挺有趣的,我也得到了一点掌声,这让我挺高兴的,但是我想让大家明白,怎么用迭代的思想来解决这个问题。
You've been listening to your parents' records and CDs and so maybe-- I'm delighted that you know this, but maybe this is too far below your dignity here so-- but good for you.
你已经听过很多父母的老唱片了,我高兴你明白这点,但是也许这些对于你来说太浅显了,但是还是对你有好处的
So I keep saying I've got one thing hanging, it's the last thing I want to do, but I wanted you see how much of a difference this makes.
但是我想让大家先,明白这有多大的不同,首先让我们仔细的来看看。
We're checking the end test and incrementing, actually I was going to, I commented that out for a reason you'll see in a second, but I, normally I would keep this on, which would let me, at each step, see what it's doing. If I ran this, it would print out each step. Which is helping me make sure that it's incrementing the right way.
对不对?进行终结测试然后递增,实际上我要,因为某些你们,马上要明白的原因我把这里注释了,但是我通常会一直这么做,这样能让我看到每一步都做了什么,如果我运行这个程序,它会在每一步都,进行显示,这能帮助我让我确信程序是,在以正确的方式递增。
So the exceptions are useful when you want to have the ability to say, I expect in general this kind of behavior, but I do know there are some other things that might happen and here's what I'd like to do in each one of those cases. But I do want to make sure that I don't let a value that I'm not expecting pass through.
所以当你希望有能力说,我希望一般是这样的行为,异常是很有用的,但是我明白还有一些其它的情况可能发生,我希望对每一种情况都这么做,但是我跟希望能保证,没有让一个预期之外的情况漏过去。
But you can see as I go up to 30 I get a pretty big number.
但是你可以明白我将参数,提高到30的话0,我就会得到一个很大的值。
应用推荐