Skip to content

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

Merged

Conversation

jonnathan-ls
Copy link
Contributor

@jonnathan-ls jonnathan-ls commented Jun 29, 2022

Conditional branching: if, '?'

πŸ“ Goal

Article translation

β˜‘ What was done?

  • Translation of the article
  • Translation of the exercises
  • Translation of the SVG image

@javascript-translate-bot javascript-translate-bot requested a review from a team June 29, 2022 03:31
@jonnathan-ls jonnathan-ls changed the title WIP: Conditional branching: if, '?' WIP Conditional branching: if, '?' Jun 29, 2022
@jonnathan-ls
Copy link
Contributor Author

🚧 work in progress

@jonnathan-ls jonnathan-ls changed the title WIP Conditional branching: if, '?' Conditional branching: if, '?' Jul 7, 2022
@jonnathan-ls
Copy link
Contributor Author

βœ… Ready for review

Copy link
Contributor

@odsantos odsantos left a 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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# 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!"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# 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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- `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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Γ€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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NΓ£o acho que a preposiΓ§Γ£o de se encaixa corretamente entre a expressΓ£o precisamos realizar

Avaliando a traduΓ§Γ£o literal:

image

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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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?', '');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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?', '');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.

Copy link
Contributor Author

@jonnathan-ls jonnathan-ls Mar 26, 2023

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:

image

@javascript-translate-bot

Please make the requested changes. After it, add a comment "/done".
Then I'll ask for a new review πŸ‘»

@odsantos
Copy link
Contributor

Hi @jonnathan-ls ,

I updated to the English version.
As part of the pending tasks could you also resolve the conflicts?

Thanks,
Osvaldo.

@jonnathan-ls
Copy link
Contributor Author

Hi @jonnathan-ls ,

I updated to the English version. As part of the pending tasks could you also resolve the conflicts?

Thanks, Osvaldo.

@odsantos conflitos resolvidos.

@jonnathan-ls
Copy link
Contributor Author

jonnathan-ls commented Mar 26, 2023

Hi, Please fell free to tell where you disagree. Thanks, Osvaldo.

@odsantos
CorreΓ§Γ΅es realizadas.

Apenas algumas sugestΓ΅es relacionadas a preposiΓ§Γ£o "de", pois entendo que fica um pouco estranho para o leitor.

@jonnathan-ls
Copy link
Contributor Author

/done

@nazarepiedady
Copy link
Member

@jonnathan-ls have you time to update this translation and correct its conflicts?

@jonnathan-ls
Copy link
Contributor Author

@jonnathan-ls have you time to update this translation and correct its conflicts?

Sure, I'll do it on the weekend

@nazarepiedady
Copy link
Member

@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.

@jonnathan-ls
Copy link
Contributor Author

Conflicts resolved @nazarepiedady

@odsantos awaiting analysis of the corrections I made according to your review

@nazarepiedady
Copy link
Member

@jonnathan-ls Are all reviews requested by @odsantos resolved?

@jonnathan-ls
Copy link
Contributor Author

Are all reviews requested by @odsantos resolved?

Yes, i am waiting his to review again

@jonnathan-ls
Copy link
Contributor Author

/done

@nazarepiedady nazarepiedady merged commit a1de0f9 into javascript-tutorial:master Dec 23, 2023
@javascript-translate-bot

Thank you πŸ’– I updated the Progress Issue #1 πŸŽ‰ πŸŽ‰ πŸŽ‰

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants