-
-
Notifications
You must be signed in to change notification settings - Fork 113
Operators #44
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
Operators #44
Conversation
dheysonalves
left a comment
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.
I put a comment on the code. There are just some incomplete words, just for the typing. However, everything okay for my reading. Gonna leave for another people to check more.
LASalvador
left a comment
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.
Fixed
Mr-Saxobeat
left a comment
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.
It was a good translation!
Please, would you follow the suggestions? And then finish the translation :D
Thanks!
| # Operadores | ||
|
|
||
| We know many operators from school. They are things like addition `+`, multiplication `*`, subtraction `-`, and so on. | ||
| Nós aprendemos muitos operadores na escolas. Alguns deles são adição `+`, multiplicação `*`, subtração `-` e assim por diante. |
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.
([] - delete; {} - add, change)
- "... operadores na escola[s]."
| - *An operand* -- is what operators are applied to. For instance, in the multiplication of `5 * 2` there are two operands: the left operand is `5` and the right operand is `2`. Sometimes, people call these "arguments" instead of "operands". | ||
| - An operator is *unary* if it has a single operand. For example, the unary negation `-` reverses the sign of a number: | ||
| - *Um operando* -- é um valor onde os operadores são aplicados. Por exemplo, na multiplicacao `5 * 2` há dois operandos: o operador da esquerda é `5` e o operador da direita é `2`. Às vezes, pessoas os chamam de "argumentos" ao inves de "operandos". | ||
| - Um operador é *unário* se ele tem um único operando. Por exemplo, o negativo unário `-` reverte o sinal de um numero: |
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 unário negativo..."
Because, "... o negativo unário..." sounds like "negativo" is an name, while it's a adjective.
| x = -x; | ||
| */!* | ||
| alert( x ); // -1, unary negation was applied | ||
| alert( x ); // -1, o negativo unário foi aplicado |
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 unário negativo..."
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.
I believe that "negação unária" would be better in that case.
| ```js run no-beautify | ||
| let x = 1, y = 3; | ||
| alert( y - x ); // 2, binary minus subtracts values | ||
| alert( y - x ); // 2, binário menos subtrai valores |
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.
Here you writed the correct order of the terms "binário menos", like you need to do on the comments above.
| ``` | ||
|
|
||
| Formally, we're talking about two different operators here: the unary negation (single operand: reverses the sign) and the binary subtraction (two operands: subtracts). | ||
| Formalmente, nós estamos falando sobre dois operadores diferentes aqui: o negativo unário (único operando: reverte o sinal) e o negativo binário (dois operandos: subtrai). |
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 unário negativo..."
- "... o binário [negativo] (subtração)..."
| Veja, não importa se o primeiro operando ou o segundo é uma string. A regra é simples: se um operando é uma string, o outro é convertido em uma string também. | ||
|
|
||
| However, note that operations run from left to right. If there are two numbers followed by a string, the numbers will be added before being converted to a string: | ||
| Entretanto, note que operatação são executadas da esquerda para direita. Se há dois números seguidos por uma string, os número serão adicionados antes e então convertidos para uma string: |
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.
- "...note que (as) [operatação] (operações)..."
- "...[adicionados] (somados)..."
| ``` | ||
|
|
||
| String concatenation and conversion is a special feature of the binary plus `+`. Other arithmetic operators work only with numbers and always convert their operands to numbers. | ||
| String concatenação e conversão é uma característica especial do binário mais `+`. Outros operadores aritméticos funcionam apenas com números e sempre convertem seus operandos para números. |
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.
- "Concatenação e conversão de string..."
| ## Conversão numérica, unário + | ||
|
|
||
| The plus `+` exists in two forms: the binary form that we used above and the unary form. | ||
| O mais `+` existe de duas formas: a forma binária que usamos acima e a forma unária. |
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.
- "... existe [de] (em) duas formas..."
| ``` | ||
|
|
||
| It actually does the same thing as `Number(...)`, but is shorter. | ||
| Na realidade faz a mesma coisa que `Number(...)`, mas é mais curto. |
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.
- "... [mas] (porém) é mais curto." - Just to avoid alliteration.
| *!* | ||
| // both values converted to numbers before the binary plus | ||
| // ambos valores convertidos para números antes do mais binário |
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.
- "... binário mais"
|
Please make the requested changes. After it, add a comment "/done". |
|
/done |
odsantos
left a comment
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,
Here is a review but the file is not complete.
The bold formatting only acts as a visual aid, please use plain text formatting.
Thanks.
|
|
||
| We know many operators from school. They are things like addition `+`, multiplication `*`, subtraction `-`, and so on. | ||
| Nós aprendemos muitos operadores na escola. Alguns deles são adição `+`, multiplicação `*`, subtração `-` e assim por diante. | ||
|
|
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.
- "Nós aprendemos sobre muitos operadores..."
- "Alguns deles são a adição
+, a multiplicação*, a subtração-..."
(do not include the bold formatting)
|
|
||
| In this chapter, we'll concentrate on aspects of operators that are not covered by school arithmetic. | ||
| Nesta capítulo, iremos nos concentrar em aspectos dos operadores que não são cobertos pela aritmética escolar. | ||
|
|
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.
- "
NestaNeste capítulo,..."
(do not include the bold formatting)
| - *An operand* -- is what operators are applied to. For instance, in the multiplication of `5 * 2` there are two operands: the left operand is `5` and the right operand is `2`. Sometimes, people call these "arguments" instead of "operands". | ||
| - An operator is *unary* if it has a single operand. For example, the unary negation `-` reverses the sign of a number: | ||
| - *Um operando* -- é um valor onde os operadores são aplicados. Por exemplo, na multiplicacao `5 * 2` há dois operandos: o operador da esquerda é `5` e o operador da direita é `2`. Às vezes, pessoas os chamam de "argumentos" ao inves de "operandos". | ||
| - Um operador é *unário* se ele tem um único operando. Por exemplo, o unário negativo `-` reverte o sinal de um numero: |
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
operadoroperando da esquerda é5e ooperadoroperando da direita é2." - "Às vezes, as pessoas..."
(do not include the bold formatting)
| ```js run no-beautify | ||
| let x = 1, y = 3; | ||
| alert( y - x ); // 2, binary minus subtracts values | ||
| alert( y - x ); // 2, binário menos subtrai valores |
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 binário menos subtrai valores"
(do not include the bold formatting)
| Normalmente, o operador mais `+` soma números. | ||
|
|
||
| But, if the binary `+` is applied to strings, it merges (concatenates) them: | ||
| Mas, se o binário `+` é aplicado em strings, junta (concatena) elas: |
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.
Agreed with @Mr-Saxobeat:
- "...é aplicado
ema strings, ele junta (concatena) elas:"
(do not include the bold formatting)
|
|
||
| See, it doesn't matter whether the first operand is a string or the second one. The rule is simple: if either operand is a string, the other one is converted into a string as well. | ||
| Veja, não importa se o primeiro operando ou o segundo é uma string. A regra é simples: se um operando é uma string, o outro é convertido em uma string também. | ||
|
|
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.
- "...convertido
empara uma string também.
(do not include the bold formatting)
|
|
||
| The unary plus or, in other words, the plus operator `+` applied to a single value, doesn't do anything to numbers. But if the operand is not a number, the unary plus converts it into a number. | ||
| O unário mais ou, em outras palavras, o operador mais `+` aplicado em um único valor, não faz nada para números. Mas se o operando não é um número, o unário mais converte-o em um número. | ||
|
|
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 mais
+aplicadoema um único valor,"
(do not include the bold formatting)
| alert( +x ); // 1 | ||
| let y = -2; | ||
| alert( +y ); // -2 |
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.
- "Sem
efeitosefeito em ..."
(do not include the bold formatting)
|
|
||
| The need to convert strings to numbers arises very often. For example, if we are getting values from HTML form fields, they are usually strings. | ||
| A necessidade de converter strings em números surge frequentemente. Por exemplo, se nós estamos pegando valores de campos de formulário HTML, eles são geralmente strings. | ||
|
|
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.
- "...campos de um formulário HTML,"
(do not include the bold formatting)
| ```js run | ||
| let apples = "2"; | ||
| let oranges = "3"; | ||
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.
- "... nós precisamos de converter e então..."
(do not include the bold formatting)
|
Please make the requested changes. After it, add a comment "/done". |
|
/done |
Mr-Saxobeat
left a comment
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, now we need you complete the translation. Thanks!
|
Please make the requested changes. After it, add a comment "/done". |
|
I'm closing this PR due to inactivity. I'm going to update the current translation with respect to the English version and start a new PR with the requested changes. |
translating operators and operands
trranslating string convertions and the unary plus