Skip to content

Commit 57f1e9e

Browse files
authored
Merge pull request #64 from Fjollsfinn/feature/conditional-branching
Feature/conditional branching
2 parents f63ae3e + 81b6c60 commit 57f1e9e

File tree

28 files changed

+291
-129
lines changed

28 files changed

+291
-129
lines changed
+4-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
**Yes, it will.**
1+
**Tak, pokaże się.**
22

3-
Any string except an empty one (and `"0"` is not empty) becomes `true` in the logical context.
3+
Każdy ciąg znaków z wyjątkiem pustego (a `"0"` nie jest puste) zostaje `true` w kontekście logicznym.
44

5-
We can run and check:
5+
Możemy uruchomić kod aby sprawdzić:
66

77
```js run
88
if ("0") {
9-
alert( 'Hello' );
9+
alert( 'Witaj' );
1010
}
1111
```
1212

Diff for: 1-js/02-first-steps/10-ifelse/1-if-zero-string/task.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ importance: 5
22

33
---
44

5-
# if (a string with zero)
5+
# if (ciąg znaków "0")
66

7-
Will `alert` be shown?
7+
czy pokaże się `alert`?
88

99
```js
1010
if ("0") {
11-
alert( 'Hello' );
11+
alert( 'Witaj' );
1212
}
1313
```
1414

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

+3-3
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('Jaka jest "oficjalna" nazwa JavaScript?', '');
99

1010
if (value == 'ECMAScript') {
11-
alert('Right!');
11+
alert('Racja!');
1212
} else {
13-
alert("You don't know? ECMAScript!");
13+
alert("Nie wiedziałeś? ECMAScript!");
1414
}
1515
</script>
1616

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

+4-3
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@ importance: 2
22

33
---
44

5-
# The name of JavaScript
5+
# Nazwa JavaScript
66

7-
Using the `if..else` construct, write the code which asks: 'What is the "official" name of JavaScript?'
7+
Używając instrukcji `if..else`, napisz kod który będzie pytał: 'Jaka jest "oficjalna" nazwa JavaScript?'
88

9-
If the visitor enters "ECMAScript", then output "Right!", otherwise -- output: "Didn't know? ECMAScript!"
9+
Jeżeli odwiedzający wpisze "ECMAScript", wtedy
10+
If the visitor enters "ECMAScript", then zwróć wynik "Racja!", w przeciwnym wypadku -- zwróć wynik: "Nie wiedziałeś? ECMAScript!"
1011

1112
![](ifelse_task2.svg)
1213

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

+1-1
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('Wpisz liczbę', 0);
1010

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

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

+1-1
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('Wpisz liczbę', 0);
55

66
if (value > 0) {
77
alert( 1 );

Diff for: 1-js/02-first-steps/10-ifelse/3-sign/task.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ importance: 2
22

33
---
44

5-
# Show the sign
5+
# Pokaż znak
66

7-
Using `if..else`, write the code which gets a number via `prompt` and then shows in `alert`:
7+
Używając instrukcji `if..else`, napisz kod który pobiera licznę za pomocą metody `prompt` i pokazuje w `alert`:
88

9-
- `1`, if the value is greater than zero,
10-
- `-1`, if less than zero,
11-
- `0`, if equals zero.
9+
- `1`, Jeżeli wartość jest większa od zera,
10+
- `-1`, jeżeli jest mniejsza od zera,
11+
- `0`, jeżeli jest równa zeru.
1212

13-
In this task we assume that the input is always a number.
13+
W tym zadaniu przyjmujemy że wpisana wartość zawsze jest liczbą.
1414

1515
[demo src="if_sign"]
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) ? 'Poniżej' : 'Ponad';
55
```
66

Diff for: 1-js/02-first-steps/10-ifelse/5-rewrite-if-question/task.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@ importance: 5
22

33
---
44

5-
# Rewrite 'if' into '?'
5+
# Przepisz instrukcję `if` na operator warunkowy '?'
66

7-
Rewrite this `if` using the conditional operator `'?'`:
7+
Przepisz tę instrukcję `if` na operator warunkowy '?'
88

99
```js
1010
let result;
1111

1212
if (a + b < 4) {
13-
result = 'Below';
13+
result = 'Poniżej';
1414
} else {
15-
result = 'Over';
15+
result = 'Ponad';
1616
}
1717
```
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11

22

33
```js
4-
let message = (login == 'Employee') ? 'Hello' :
5-
(login == 'Director') ? 'Greetings' :
6-
(login == '') ? 'No login' :
4+
let message = (login == 'Pracownik') ? 'Witaj' :
5+
(login == 'Dyrektor') ? 'Pozdrowienia' :
6+
(login == '') ? 'Brak loginu' :
77
'';
88
```
99

Diff for: 1-js/02-first-steps/10-ifelse/6-rewrite-if-else-question/task.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@ importance: 5
22

33
---
44

5-
# Rewrite 'if..else' into '?'
5+
# Przepisz instrukcję `if` na operator warunkowy '?
66

7-
Rewrite `if..else` using multiple ternary operators `'?'`.
7+
Przepisz instrukcję `if` na używając wielokrotnego operatora warunkowego '?`.
88

9-
For readability, it's recommended to split the code into multiple lines.
9+
Dla czytelności zalecamy podzielić kod na wiele linii.
1010

1111
```js
1212
let message;
1313

14-
if (login == 'Employee') {
15-
message = 'Hello';
16-
} else if (login == 'Director') {
17-
message = 'Greetings';
14+
if (login == 'Pracownik') {
15+
message = 'Witaj';
16+
} else if (login == 'Dyrektor') {
17+
message = 'Pozdrowienia';
1818
} else if (login == '') {
19-
message = 'No login';
19+
message = 'Brak loginu';
2020
} else {
2121
message = '';
2222
}

0 commit comments

Comments
 (0)