Update article.md

This commit is contained in:
Alexander 2017-10-26 02:10:38 +03:00 committed by GitHub
parent ccc0e9327f
commit a851ef6afc

View file

@ -68,7 +68,7 @@ pow(x, n) =
``` ```
1. If `n == 1`, then everything is trivial. It is called *the base* of recursion, because it immediately produces the obvious result: `pow(x, 1)` equals `x`. 1. If `n == 1`, then everything is trivial. It is called *the base* of recursion, because it immediately produces the obvious result: `pow(x, 1)` equals `x`.
2. Otherwise, we can represent `pow(x, n)` as `x * pow(x, n-1)`. In maths, one would write <code>x<sup>n</sup> = x * x<sup>n-1</sup></code>. This is called *a recursive step*: we transform the task into a simpler action (multiplication by `x`) and a simpler call of the same task (`pow` with lower `n`). Next steps simplify it further and further untill `n` reaches `1`. 2. Otherwise, we can represent `pow(x, n)` as `x * pow(x, n - 1)`. In maths, one would write <code>x<sup>n</sup> = x * x<sup>n-1</sup></code>. This is called *a recursive step*: we transform the task into a simpler action (multiplication by `x`) and a simpler call of the same task (`pow` with lower `n`). Next steps simplify it further and further until `n` reaches `1`.
We can also say that `pow` *recursively calls itself* till `n == 1`. We can also say that `pow` *recursively calls itself* till `n == 1`.
@ -134,7 +134,7 @@ We can sketch it as:
</li> </li>
</ul> </ul>
That's when the function starts to execute. The condition `n == 1` is falsy, so the flow continues into the second branch of `if`: That's when the function starts to execute. The condition `n == 1` is false, so the flow continues into the second branch of `if`:
```js run ```js run
function pow(x, n) { function pow(x, n) {
@ -395,7 +395,7 @@ A company *department* is:
- Either an array of people. - Either an array of people.
- Or an object with *departments*. - Or an object with *departments*.
For web-developers there are much better known examples: HTML and XML documents. For web-developers there are much better-known examples: HTML and XML documents.
In the HTML document, an *HTML-tag* may contain a list of: In the HTML document, an *HTML-tag* may contain a list of:
- Text pieces. - Text pieces.