And the main one is, I get to just decide, how do I want to use this, and call it.
但是这真的会有一些好处,最重要的一点是,我需要决定,我要如何来使用这个方法,以及如何来调用它。
And typically, I'm not going to just search once in a list, I'm going to search multiple times.
还要考虑我要如何去使用它?,我不会对一个列表只做一次搜索。
And the idea behind recursion I'm going to describe with a simple example. And then I'm going to show you how we can actually use it.
但是为了解释递归的意义,我想举个简单的例子,我将会给你们展示我们该如何使用它。
What is this? This is a wonderful piece of abstraction. It is saying, you don't need to know squat about what's inside the body of this function. You don't have to worry about the parameter names, because they're going to be preserved, you don't need to worry about how I'm doing it, this tells you how you can use this, in order to use it correctly. Of course, I can then close it off, and off we go.
但是这能告诉你一些信息,这是什么?,这是一段完美的抽象,它的意思是你不需要知道,这个函数的内部构造,你不必担心参数是否重名,因为它们已经被预存了,你不需要担心我如何使用它,它告诉了你你该如何操作,从而正确的使用它,当然我也可以把它关掉。
应用推荐