Skip to content

Commit

Permalink
Merge pull request #49 from mdb1/patch-4
Browse files Browse the repository at this point in the history
Update portuguese math_operations.md
  • Loading branch information
vasa-develop committed Oct 5, 2020
2 parents 100ffee + a6a256d commit 40cf2e4
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions pt-br/1/math_operations.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,29 @@
<!-- Add translation for the following page: https://vyper.fun/#/1/math_operations
Do NOT change the code below. The below code runs the code editor -->

# Capítulo 3: Operações Matemáticas

A matemática em Vyper é bastante simples. As seguintes operações são iguais às da maioria das linguagens de programação:

- Adição: `x + y`
- Subtração: `x - y`
- Multiplicação: `x * y`
- Divisão: `x / y`
- Módulo / resto: `x % y` (por exemplo, `13% 5` é `3`, porque se você dividir `5` em `13`,` 3` é o resto)

Vyper também suporta um operador exponencial (ou seja, "`x` elevado à potência de `y`", `x ^ y`):

```vyper
# igual a 5^2 = 25
uint256 x = 5 ** 2
```

## Coloca-lo a prova

Para ter certeza de que o DNA do nosso Pokémon tem apenas 16 caracteres, vamos fazer outra `constant` `uint256` igual a `10 ^ 16`. Dessa forma, podemos usar posteriormente o operador de módulo `%` para encurtar um número inteiro para 16 dígitos.

1. Crie uma `constante` `uint256` chamada` DNA_MODULUS` e defina-a igual a `10` com a potência de` DNA_DIGITS`.

<!-- tabs:start -->

#### ** Template **
Expand Down

0 comments on commit 40cf2e4

Please sign in to comment.