Skip to content

Commit 12cac84

Browse files
authored
Merge pull request #123 from galenteryan/condition
Conditional branching: if, '?'
2 parents 5a853aa + 201a313 commit 12cac84

File tree

12 files changed

+43
-43
lines changed

12 files changed

+43
-43
lines changed
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
**Yes, it will.**
1+
**Այո, կցուցադրվի:**
22

3-
Any string except an empty one (and `"0"` is not empty) becomes `true` in the logical context.
3+
Ցանկացած տող, բացի դատարկից (իսկ `"0"`-ն դատարկ չէ) տրամաբանական համատեքստում դառնում է `true`:
44

5-
We can run and check:
5+
Մենք կարող ենք գործարկել և ստուգել.
66

77
```js run
88
if ("0") {
9-
alert( 'Hello' );
9+
alert( 'Ողջույն' );
1010
}
1111
```
1212

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
importance: 5
1+
կարևորությունը՝ 5
22

33
---
44

5-
# if (a string with zero)
5+
# if (զրոյով տող)
66

7-
Will `alert` be shown?
7+
Կցուցադրվի՞ արդյոք `alert`-ը:
88

99
```js
1010
if ("0") {
11-
alert( 'Hello' );
11+
alert( 'Ողջույն' );
1212
}
1313
```
1414

Lines changed: 1 addition & 1 deletion
Loading

1-js/02-first-steps/10-ifelse/2-check-standard/ifelse_task2/index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
<script>
66
'use strict';
77

8-
let value = prompt('What is the "official" name of JavaScript?', '');
8+
let value = prompt('Ո՞րն է JavaScript-ի «պաշտոնական» անվանումը:', '');
99

1010
if (value == 'ECMAScript') {
11-
alert('Right!');
11+
alert('Ճիշտ է:');
1212
} else {
13-
alert("You don't know? ECMAScript!");
13+
alert("Դուք չգիտե՞ք. ECMAScript:");
1414
}
1515
</script>
1616

1-js/02-first-steps/10-ifelse/2-check-standard/task.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
importance: 2
1+
կարևորությունը՝ 2
22

33
---
44

5-
# The name of JavaScript
5+
# JavaScript-ի անվանումը
66

7-
Using the `if..else` construct, write the code which asks: 'What is the "official" name of JavaScript?'
7+
Օգտագործելով `if..else` կառուցվածքը, գրեք կոդ, որը կհարցնի. «Ո՞րն է JavaScript-ի «պաշտոնական» անվանումը:»։
88

9-
If the visitor enters "ECMAScript", then output "Right!", otherwise -- output: "You don't know? ECMAScript!"
9+
Եթե այցելուն մուտքագրում է «ECMAScript», ապա արտատպեք «Ճիշտ է:», հակառակ դեպքում՝ արտատպեք «Դուք չգիտե՞ք. ECMAScript:»:
1010

1111
![](ifelse_task2.svg)
1212

1-js/02-first-steps/10-ifelse/3-sign/if_sign/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<script>
77
'use strict';
88

9-
let value = prompt('Type a number', 0);
9+
let value = prompt('Մուտքագրեք թիվ', 0);
1010

1111
if (value > 0) {
1212
alert(1);

1-js/02-first-steps/10-ifelse/3-sign/solution.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22

33
```js run
4-
let value = prompt('Type a number', 0);
4+
let value = prompt('Մուտքագրեք թիվ', 0);
55

66
if (value > 0) {
77
alert( 1 );
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
importance: 2
1+
կարևորությունը՝ 2
22

33
---
44

5-
# Show the sign
5+
# Ցույց տալ նշանը
66

7-
Using `if..else`, write the code which gets a number via `prompt` and then shows in `alert`:
7+
Օգտագործելով `if..else`՝ գրեք այնպիսի կոդ, որը `prompt`-ի միջոցով ստանում է թիվ և այնուհետև `alert`-ով ցուցադրում է.
88

9-
- `1`, if the value is greater than zero,
10-
- `-1`, if less than zero,
11-
- `0`, if equals zero.
9+
- `1`, եթե արժեքը մեծ է զրոյից,
10+
- `-1`, եթե փոքր է զրոյից,
11+
- `0`, եթե հավասար է զրոյի։
1212

13-
In this task we assume that the input is always a number.
13+
Այս առաջադրանքում մենք ենթադրում ենք, որ մուտքագրվածը միշտ թիվ է:
1414

1515
[demo src="if_sign"]
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22

33
```js
4-
let result = (a + b < 4) ? 'Below' : 'Over';
4+
let result = (a + b < 4) ? 'Ցածր' : 'Բարձր';
55
```
66

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
importance: 5
1+
կարևորությունը՝ 5
22

33
---
44

5-
# Rewrite 'if' into '?'
5+
# «if»-ը փոխարինեք «?»-ով
66

7-
Rewrite this `if` using the conditional operator `'?'`:
7+
Վերագրեք այս `if`-ը՝ օգտագործելով `'?'` պայմանական օպերատորը.
88

99
```js
1010
let result;
1111

1212
if (a + b < 4) {
13-
result = 'Below';
13+
result = 'Ցածր';
1414
} else {
15-
result = 'Over';
15+
result = 'Բարձր';
1616
}
1717
```

0 commit comments

Comments
 (0)