- Notifications
You must be signed in to change notification settings - Fork111
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Conditional branching: if, '?'#246
Uh oh!
There was an error while loading.Please reload this page.
Conversation
🚧 work in progress |
✅ 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.
--- | ||
#if (astring 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) |
Usando a construção`if..else`, escreva o código que pergunta: 'Qual é o nome "oficial" do JavaScript?' | ||
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çãoalerta 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!" |
--- | ||
#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`, seforigual a zero. | |
-`0`, se igual a zero. |
#Ramificação condicional: if, '?' | ||
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, precisamosderealizar 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 vezesreferê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?', ''); |
**Não é recomendado usar o operador de ponto de interrogação dessa maneira.** | ||
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,oque 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?', ''); |
Nossos olhos escaneiam o código verticalmente. Blocos de código que abrangem várias linhas são mais fáceis de entender do que um conjunto de instruções longo e horizontal. | ||
The purpose of the question mark operator`?`is to return one value or another depending on its condition. Pleaseuse 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 precisardeexecutar diferentes ramificações de código. |
jonnathan-lsMar 26, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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 ahttps://github.com/javascript-tutorial/pt.javascript.info/pull/246/files#r1148666022
Sem a preposição fica o mais próximo da tradução literal:
javascript-translate-bot commentedDec 6, 2022
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
@odsantos conflitos resolvidos. |
jonnathan-ls commentedMar 26, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@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 |
javascript-translate-bot commentedDec 23, 2023
Thank you 💖 I updated the Progress Issue#1 🎉 🎉 🎉 |
Uh oh!
There was an error while loading.Please reload this page.
Conditional branching: if, '?'
📝Goal
☑ What was done?