Skip to content

Commit b553adf

Browse files
committed
add switch directory files translation
1 parent 58c2842 commit b553adf

File tree

5 files changed

+26
-28
lines changed

5 files changed

+26
-28
lines changed
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
To precisely match the functionality of `switch`, the `if` must use a strict comparison `'==='`.
1+
Para executar precisamente a funcionalidade do `switch`, o `if` deve empregar uma comparação exata (*strict comparison*) `'==='`.
22

3-
For given strings though, a simple `'=='` works too.
3+
Contudo, para certas *strings* um simples `'=='` tanbém serve.
44

55
```js no-beautify
66
if(browser == 'Edge') {
7-
alert("You've got the Edge!");
7+
alert("Você usa o Edge!");
88
} else if (browser == 'Chrome'
99
|| browser == 'Firefox'
1010
|| browser == 'Safari'
1111
|| browser == 'Opera') {
12-
alert( 'Okay we support these browsers too' );
12+
alert( 'Esta bem, também suportamos esse navegador (browser).' );
1313
} else {
14-
alert( 'We hope that this page looks ok!' );
14+
alert( 'Esperamos que esta página tenha uma boa apresentação!' );
1515
}
1616
```
1717

18-
Please note: the construct `browser == 'Chrome' || browser == 'Firefox' …` is split into multiple lines for better readability.
18+
Por favor, note: a construção `browser == 'Chrome' || browser == 'Firefox' …` está repartida por múltiplas linhas para melhor leitura.
1919

20-
But the `switch` construct is still cleaner and more descriptive.
20+
Mas, a construção `switch` ainda é mais simples e mais descritiva.
Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,25 @@
1-
importance: 5
1+
importância: 5
22

33
---
44

5-
# Rewrite the "switch" into an "if"
5+
# Transforme o "*switch*" num "*if*"
66

7-
Write the code using `if..else` which would correspond to the following `switch`:
7+
Escreva o código empregando `if..else`, que corresponda ao seguinte `switch`:
88

99
```js
1010
switch (browser) {
1111
case 'Edge':
12-
alert( "You've got the Edge!" );
12+
alert( "Você usa o Edge!" );
1313
break;
1414

1515
case 'Chrome':
1616
case 'Firefox':
1717
case 'Safari':
1818
case 'Opera':
19-
alert( 'Okay we support these browsers too' );
19+
alert( 'Esta bem, também suportamos esse navegador (browser).' );
2020
break;
2121

2222
default:
23-
alert( 'We hope that this page looks ok!' );
23+
alert( 'Esperamos que esta página tenha uma boa apresentação!' );
2424
}
2525
```
26-

1-js/02-first-steps/13-switch/2-rewrite-if-switch/solution.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
The first two checks turn into two `case`. The third check is split into two cases:
1+
As duas primeiras verificações se tornam em dois `case`. A terceira verificação está dividida em dois casos (*cases*):
22

33
```js run
44
let a = +prompt('a?', '');
@@ -21,6 +21,6 @@ switch (a) {
2121
}
2222
```
2323

24-
Please note: the `break` at the bottom is not required. But we put it to make the code future-proof.
24+
Por favor, note: o `break` no final não é necessário. Mas o colocamos para salvaguardar futuro código.
2525

26-
In the future, there is a chance that we'd want to add one more `case`, for example `case 4`. And if we forget to add a break before it, at the end of `case 3`, there will be an error. So that's a kind of self-insurance.
26+
No futuro, pode existir a chance de querermos adicionar mais um `case`, por exemplo `case 4`. E, se nos esquecermos de adicionar um *break* antes dele, no fim de `case 3`, haverá um erro. Assim, é uma espécie precaução pessoal.

1-js/02-first-steps/13-switch/2-rewrite-if-switch/task.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
importance: 4
1+
importância: 4
22

33
---
44

5-
# Rewrite "if" into "switch"
5+
# Transforme o "if" num "switch"
66

7-
Rewrite the code below using a single `switch` statement:
7+
Reescreva o código abaixo empregando uma única instrução `switch`:
88

99
```js run
1010
let a = +prompt('a?', '');
@@ -20,4 +20,3 @@ if (a == 2 || a == 3) {
2020
alert( '2,3' );
2121
}
2222
```
23-

1-js/02-first-steps/13-switch/article.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# A instrução "switch"
22

3-
Uma instrução `switch` pode substituir muitas comparações `se`.
3+
Uma instrução `switch` pode substituir muitas comparações `if` (se).
44

55
Ela é uma forma mais descritiva de comparar um valor com múltiplas variantes.
66

@@ -50,7 +50,7 @@ switch (a) {
5050
alert( 'Muito alto' );
5151
break;
5252
default:
53-
alert( "Não conheço tais valores" );
53+
alert( "Não conheço tal valor" );
5454
}
5555
```
5656

@@ -74,7 +74,7 @@ switch (a) {
7474
case 5:
7575
alert( 'Muito alto' );
7676
default:
77-
alert( "Não conheço tais valores" );
77+
alert( "Não conheço tal valor" );
7878
*/!*
7979
}
8080
```
@@ -84,10 +84,10 @@ No exemplo acima, vemos uma execução sequential de três `alert`'s:
8484
```js
8585
alert( 'Exacto!' );
8686
alert( 'Muito alto' );
87-
alert( "Não conheço tais valores" );
87+
alert( "Não conheço tal valor" );
8888
```
8989

90-
````smart header="Any expression can be a switch/case argument"
90+
````smart header="Quaquer expressão pode servir de argumento para switch/case"
9191
Ambos `switch` e `case` permitem expressões arbitrárias.
9292
9393
Por exemplo:
@@ -133,7 +133,7 @@ switch (a) {
133133
*/!*
134134

135135
default:
136-
alert('O resultado é stranho. Realmente.');
136+
alert('O resultado é estranho. Realmente.');
137137
}
138138
```
139139

@@ -143,7 +143,7 @@ A habilidade para "agrupar" cases é um efeito secundário de como `switch/case`
143143

144144
## O tipo importa
145145

146-
Vamos emfatizar que a verificação da igualdade é sempre exata. Os valores devem também ser do mesmo tipo para existir correspondência.
146+
Vamos enfatizar que a verificação da igualdade é sempre exata. Os valores também devem ser do mesmo tipo para existir correspondência.
147147

148148
Por exemplo, consideremos o código:
149149

0 commit comments

Comments
 (0)