Skip to content

Commit d8b61f4

Browse files
authored
Update article.md
1 parent 3f93812 commit d8b61f4

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

1-js/02-first-steps/10-ifelse/article.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
# Conditional branching: if, '?'
1+
# Шарттуу бутактануу: if, '?'
22

33
Sometimes, we need to perform different actions based on different conditions.
44

55
To do that, we can use the `if` statement and the conditional operator `?`, that's also called a "question mark" operator.
66

7-
## The "if" statement
7+
## "if" нускамасы
88

99
The `if(...)` statement evaluates a condition in parentheses and, if the result is `true`, executes a block of code.
1010

11-
For example:
11+
Мисалы:
1212

1313
```js run
1414
let year = prompt('In which year was ECMAScript-2015 specification published?', '');
1515

1616
*!*
17-
if (year == 2015) alert( 'You are right!' );
17+
if (year == 2015) alert( 'Туура айтасыз!' );
1818
*/!*
1919
```
2020

@@ -24,14 +24,14 @@ If we want to execute more than one statement, we have to wrap our code block in
2424

2525
```js
2626
if (year == 2015) {
27-
alert( "That's correct!" );
28-
alert( "You're so smart!" );
27+
alert( "Бул туура!" );
28+
alert( "Сиз абдан акылдуусуз!" );
2929
}
3030
```
3131

3232
We recommend wrapping your code block with curly braces `{}` every time you use an `if` statement, even if there is only one statement to execute. Doing so improves readability.
3333

34-
## Boolean conversion
34+
## Логикалык айландыруу
3535

3636
The `if (…)` statement evaluates the expression in its parentheses and converts the result to a boolean.
3737

@@ -43,15 +43,15 @@ Let's recall the conversion rules from the chapter <info:type-conversions>:
4343
So, the code under this condition would never execute:
4444

4545
```js
46-
if (0) { // 0 is falsy
46+
if (0) { // 0 бул жалган
4747
...
4848
}
4949
```
5050

5151
...and inside this condition -- it always will:
5252

5353
```js
54-
if (1) { // 1 is truthy
54+
if (1) { // 1 бул чындык
5555
...
5656
}
5757
```

0 commit comments

Comments
 (0)