Skip to content

Commit

Permalink
Merge pull request #579 from evemrzv/main
Browse files Browse the repository at this point in the history
proofread lessons 6-14
  • Loading branch information
NatalieKonstantinova committed Mar 23, 2022
2 parents cd29281 + 97361d1 commit 1ce661a
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions modules/20-arithmetics/20-basic/description.en.yml
Expand Up @@ -13,7 +13,7 @@ theory: |
3 + 4;
```
Statement `3 + 4`, makes the computer add up the numbers and find the result. If you run this program, nothing will happen. Precisely, the computer will calculate the sum, but that’s it. The result of the addition is useless, and such a program has no value. We need to ask the computer to add `3 + 4`, and give a command to do something with the result. For example, to print it:
Statement `3 + 4` makes the computer add up the numbers and find the result. If you run this program, nothing will happen. Precisely, the computer will calculate the sum, but that’s it. The result of the addition is useless, and such a program has no value. We need to ask the computer to add `3 + 4`, and give a command to do something with the result. For example, to print it:
```javascript
// The sum is calculated first,
Expand Down Expand Up @@ -46,7 +46,7 @@ theory: |
instructions: |
Print the result of dividing 81 by 9.
Print the result of dividing `81` by `9`.
tips:
- |
Expand Down
6 changes: 3 additions & 3 deletions modules/20-arithmetics/25-operator/description.en.yml
Expand Up @@ -2,7 +2,7 @@

name: Operators
theory: |
Before we move on, let's grasp the basic terminology. Operation signs such as `+` are called **operators**. They perform operations on certain values (**operands).** Operators are usually represented by one or more symbols, less often by a word. Most of the operators are identical to those from arithmetics.
Before we move on, let's grasp the basic terminology. Operation signs such as `+` are called **operators**. They perform operations on certain values (**operands**). Operators are usually represented by one or more symbols, less often by a word. Most of the operators are identical to those from arithmetics.
```javascript
console.log(8 + 2);
Expand All @@ -16,9 +16,9 @@ theory: |
```javascript
console.log(-3); // => -3
```
In the example above a unary operation applies to `3`. An interpreter reads it as follows: the minus operator tells him to take the number `3` and find the opposite, which is `-3`.
In the example above the unary operation applies to `3`. An interpreter reads it as follows: the minus operator tells him to take the number `3` and find the opposite, which is `-3`.
You might be a bit confused since `-3` is both a number and an operator with an operand but that's how programming languages work.
You might be a bit confused since `-3` is both a number and an operator with an operand, but that's how programming languages work.
instructions: |
Write a program that calculates and prints the difference between `6` and `-81`.
Expand Down
4 changes: 2 additions & 2 deletions modules/20-arithmetics/27-commutativity/description.en.yml
Expand Up @@ -4,7 +4,7 @@ name: Commutative operations
theory: |
Do you remember the basic arithmetic rule «changing the order of the numbers we are adding doesn't change the sum»? It is called the **commutative law**.
A binary operation is commutative, since you swap operands and you get the same result. Obviously, addition is a commutative operation: _3 + 2 = 2 + 3_.
A binary operation is commutative since swapping operands get you the same result. Obviously, addition is a commutative operation: _3 + 2 = 2 + 3_.
But is subtraction the commutative operation? Of course not: _2 - 3 ≠ 3 - 2_. In programming, this law works just like in arithmetic.
Expand All @@ -19,4 +19,4 @@ tips: []
definitions:
- name: Commutativity
description: |
is a property of an operation when changing the order of the operands does not change the result. For example, addition is a commutative operation: changing the order of the numbers we are adding, does not change the sum.
is a property of an operation when changing the order of the operands does not change the result. For example, addition is a commutative operation: changing the order of the numbers we are adding does not change the sum.
2 changes: 1 addition & 1 deletion modules/20-arithmetics/50-float/description.en.yml
Expand Up @@ -17,7 +17,7 @@ theory: |
0.2 * 0.2 // 0.04000000000000001
```
The operation of multiplying two rational numbers suddenly printed an inaccurate result. The same result other programming languages give. This happens due to the limits of computing power. The amount of memory, unlike numbers, is finite (an infinite amount of numbers requires an infinite amount of memory for its storage). Such a problem with natural numbers is solved by a simple constraint on the upper boundary (there is some maximum number that can be entered), except for rational numbers it is impossible.
The operation of multiplying two rational numbers suddenly printed an inaccurate result. Other programming languages deliver the same result. This happens due to the limits of computing power. The amount of memory, unlike numbers, is finite (an infinite amount of numbers requires an infinite amount of memory for its storage). This issue in the case of natural numbers is solved by a simple upper bound constraint (you set the maximum number allowed), which is impossible for rationals.
```javascript
// Maximum possible integer
Expand Down
2 changes: 1 addition & 1 deletion modules/20-arithmetics/60-infinity/description.en.yml
Expand Up @@ -22,6 +22,6 @@ theory: |
instructions: |
Print the amount of infinity divided by 10.
Print the sum of infinities divided by 10.
tips: []
4 changes: 2 additions & 2 deletions modules/20-arithmetics/70-nan/description.en.yml
Expand Up @@ -15,11 +15,11 @@ theory: |
NaN + 1; // NaN
```
`NaN` is a peculiar value. Although it means "not a number", in terms of types it is a number. Paradox. `NaN` is never a desired value, once it appears only as a result of errors. If you have got him, you need to track the moment at which the operation, which is not valid for numbers, was performed, and correct this piece of code.
`NaN` is a peculiar value. Although it means "not a number", in terms of types it is a number. Paradox. `NaN` is never a desired value, once it appears only as a result of errors. If you have encountered it, trace the moment where the operation, which is not valid for numbers, was performed, and correct this piece of code.
instructions: |
Execute the operation that returnts NaN and print it using console.log().
Execute the operation that returnts NaN and print it using `console.log()`.
tips:
- |
Expand Down
4 changes: 2 additions & 2 deletions modules/20-arithmetics/80-linting/description.en.yml
Expand Up @@ -37,9 +37,9 @@ theory: |
Unfortunately, yes. This time, operations `*` and `/` are in the same expression and parentheses are missing . You can solve this problem by adding additional parentheses. But at some point, too many parentheses can make the code incomprehensible again. At this point you can divide the expression into separate parts. We will learn how to do this in the following lessons.
[no-mixed-operators](https://eslint.org/docs/rules/no-mixed-operators) — is an example of many rules. Other ones describe indentations, entity names, parentheses, mathematical operations, line length, and many other aspects. Each individual rule seems rather small, not very important. But together they form the basis of a good code.
[no-mixed-operators](https://eslint.org/docs/rules/no-mixed-operators) — is an example of many rules. Other ones describe indentations, entity names, parentheses, mathematical operations, line length, and many other aspects. Each rule seems small and insignificant, but together they form the basis of a good code.
CodeBasics won'tt test your code with a linter now, but in your future Hexlet practices and in the actual development the linter will work and flag the bugs.
CodeBasics won't test your code with a linter now, but in your future Hexlet practices and in the actual development the linter will work and flag the bugs.
instructions: |
Expand Down

0 comments on commit 1ce661a

Please sign in to comment.