-
Notifications
You must be signed in to change notification settings - Fork 112
Conditional branching: if, '?' #246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conditional branching: if, '?' #246
Conversation
π§ work in progress |
β¦t.info into feature/steps-ifelse
β Ready for review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, Please fell free to tell where you disagree. Thanks, Osvaldo.
@@ -2,13 +2,13 @@ importance: 5 | |||
|
|||
--- | |||
|
|||
# if (a string with zero) | |||
# f (uma βstringβ com zero) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# f (uma βstringβ com zero) | |
# if (uma βstringβ com zero) |
|
||
If the visitor enters "ECMAScript", then output "Right!", otherwise -- output: "You don't know? ECMAScript!" | ||
Se o visitante digitar "ECMAScript", entΓ£o chame a funΓ§Γ£o alerta passando como valor: "correto!", caso contrΓ‘rio -- registre a seguinte mensagem: "VocΓͺ nΓ£o sabe? ECMAScript!" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Se o visitante digitar "ECMAScript", entΓ£o chame a funΓ§Γ£o alerta passando como valor: "correto!", caso contrΓ‘rio -- registre a seguinte mensagem: "VocΓͺ nΓ£o sabe? ECMAScript!" | |
Se o visitante digitar "ECMAScript", entΓ£o chame a funΓ§Γ£o `alert` passando como valor: "Correto!", caso contrΓ‘rio -- registre a seguinte mensagem: "VocΓͺ nΓ£o sabe? ECMAScript!" |
@@ -2,14 +2,14 @@ importance: 2 | |||
|
|||
--- | |||
|
|||
# Show the sign | |||
# Mostra o sinal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Mostra o sinal | |
# Mostre o sinal |
- `0`, if equals zero. | ||
- `1`, se o valor for maior que zero, | ||
- `-1`, se menor que zero, | ||
- `0`, se for igual a zero. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- `0`, se for igual a zero. | |
- `0`, se igual a zero. |
|
||
Sometimes, we need to perform different actions based on different conditions. | ||
Γs vezes, precisamos realizar aΓ§Γ΅es diferentes com base em condiΓ§Γ΅es diferentes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Γs vezes, precisamos realizar aΓ§Γ΅es diferentes com base em condiΓ§Γ΅es diferentes. | |
Γs vezes, precisamos de realizar aΓ§Γ΅es diferentes com base em condiΓ§Γ΅es diferentes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The so-called "conditional" or "question mark" operator lets us do that in a shorter and simpler way. | ||
O chamado operador "condicional" ou "ponto de interrogaΓ§Γ£o" nos permite fazer isso de uma forma curta e simples. | ||
|
||
O operador Γ© representado por um ponto de interrogaΓ§Γ£o `?`. Γs vezes referΓͺnciado como "ternΓ‘rio", porque o operador possui trΓͺs operandos. Na verdade, Γ© o ΓΊnico operador em JavaScript que possui tantos. Na verdade, Γ© o ΓΊnico operador em JavaScript que possui tantas possibilidades de operandos. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
O operador Γ© representado por um ponto de interrogaΓ§Γ£o `?`. Γs vezes referΓͺnciado como "ternΓ‘rio", porque o operador possui trΓͺs operandos. Na verdade, Γ© o ΓΊnico operador em JavaScript que possui tantos. Na verdade, Γ© o ΓΊnico operador em JavaScript que possui tantas possibilidades de operandos. | |
O operador Γ© representado por um ponto de interrogaΓ§Γ£o `?`. Γs vezes Γ© chamado de "ternΓ‘rio", porque o operador possui trΓͺs operandos. Na verdade, Γ© o ΓΊnico operador em JavaScript que possui tantos. |
|
||
```js run no-beautify | ||
let company = prompt('Which company created JavaScript?', ''); | ||
let company = prompt('Qual empresa criou o JavaScript?', ''); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let company = prompt('Qual empresa criou o JavaScript?', ''); | |
let company = prompt('Que empresa criou o JavaScript?', ''); |
|
||
The notation is shorter than the equivalent `if` statement, which appeals to some programmers. But it is less readable. | ||
A notaΓ§Γ£o Γ© mais curta do que a instruΓ§Γ£o `if` equivalente, que atrai alguns programadores. Mas Γ© menos legΓvel. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A notaΓ§Γ£o Γ© mais curta do que a instruΓ§Γ£o `if` equivalente, que atrai alguns programadores. Mas Γ© menos legΓvel. | |
A notaΓ§Γ£o Γ© mais curta do que a instruΓ§Γ£o `if` equivalente, o que atrai alguns programadores. Mas Γ© menos legΓvel. |
|
||
```js run no-beautify | ||
let company = prompt('Which company created JavaScript?', ''); | ||
let company = prompt('Qual empresa criou o JavaScript?', ''); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let company = prompt('Qual empresa criou o JavaScript?', ''); | |
let company = prompt('Que empresa criou o JavaScript?', ''); |
|
||
The purpose of the question mark operator `?` is to return one value or another depending on its condition. Please use it for exactly that. Use `if` when you need to execute different branches of code. | ||
O objetivo do operador de ponto de interrogaΓ§Γ£o `?` Γ© retornar um valor ou outro dependendo de sua condiΓ§Γ£o. Por favor, use-o exatamente para isso. Use `if` quando precisar executar diferentes ramificaΓ§Γ΅es de cΓ³digo. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
O objetivo do operador de ponto de interrogaΓ§Γ£o `?` Γ© retornar um valor ou outro dependendo de sua condiΓ§Γ£o. Por favor, use-o exatamente para isso. Use `if` quando precisar executar diferentes ramificaΓ§Γ΅es de cΓ³digo. | |
O objetivo do operador de ponto de interrogaΓ§Γ£o `?` Γ© retornar um valor ou outro dependendo de sua condiΓ§Γ£o. Por favor, use-o exatamente para isso. Use `if` quando precisar de executar diferentes ramificaΓ§Γ΅es de cΓ³digo. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Semelhante a https://github.com/javascript-tutorial/pt.javascript.info/pull/246/files#r1148666022
Sem a preposiΓ§Γ£o fica o mais prΓ³ximo da traduΓ§Γ£o literal:
Please make the requested changes. After it, add a comment "/done". |
Hi @jonnathan-ls , I updated to the English version. Thanks, |
β¦t.info into feature/steps-ifelse
β¦207296036 Code Review: javascript-tutorial#246 (review)
@odsantos conflitos resolvidos. |
@odsantos Apenas algumas sugestΓ΅es relacionadas a preposiΓ§Γ£o "de", pois entendo que fica um pouco estranho para o leitor. |
/done |
@jonnathan-ls have you time to update this translation and correct its conflicts? |
Sure, I'll do it on the weekend |
@jonnathan-ls I also recommend looking at all your pull requests to see what more needs to be done to let the pull request fine be applied. |
β¦vascript.info into feature/steps-ifelse
Conflicts resolved @nazarepiedady @odsantos awaiting analysis of the corrections I made according to your review |
@jonnathan-ls Are all reviews requested by @odsantos resolved? |
Yes, i am waiting his to review again |
/done |
Thank you π I updated the Progress Issue #1 π π π |
Conditional branching: if, '?'
π Goal
β What was done?