Variables and DECLARE · Variáveis e DECLARE
This page needs a recent browser (with SharedArrayBuffer support). Please update Chrome, Edge, Firefox or Safari to the latest version. · Esta página precisa de um navegador recente (com suporte a SharedArrayBuffer). Por favor, atualize Chrome, Edge, Firefox ou Safari para a versão mais recente.
English
A variable stores one value
- A variable has a name and holds one value you can change.
- The 2026 guide writes names in mixed case, starting with a letter:
NumberOfPlayersornumberOfPlayers. - These lessons use a capital first letter, the same shape as the guide's own examples.
Português
Uma variável armazena um único valor
- Uma variável tem um nome e armazena um único valor que você pode alterar.
- O guia de 2026 escreve nomes em camelCase, começando com uma letra:
NumberOfPlayersounumberOfPlayers. - Estas lições usam primeira letra maiúscula, o mesmo formato dos próprios exemplos do guia.
DECLARE Counter : INTEGER
Counter ← 0
Counter ← Counter + 1
OUTPUT Counter
English
DECLARE, then the arrow
DECLARE Counter : INTEGERcreates the variable and names its type.- The assignment operator is
←. It stores the value on the right. =is not how you store a value.=means "is equal to" inside a test.
Português
DECLARE, seguido pela seta
DECLARE Counter : INTEGERcria a variável e nomeia seu tipo.- O operador de atribuição é
←. Ele armazena o valor à direita. =não é como armazenar um valor.=significa "é igual a" dentro de uma condição.
DECLARE Score : INTEGER
Score ← 40
Score ← Score + 2
OUTPUT Score
English
Watch out
- Declare a variable before you use it.
- An identifier starts with a letter. Digits may follow. The guide also allows
_.
Português
Atenção
- Declare uma variável antes de usá-la.
- Um identificador começa com uma letra. Dígitos podem seguir. O guia também permite
_.
English
Common mistakes
Counter ← 1stores 1.Counter = 1is not an assignment.- One variable holds one value. Assigning again replaces it.
Português
Erros comuns
Counter ← 1armazena 1.Counter = 1não é uma atribuição.- Uma variável armazena um único valor. Atribuir novamente substitui o anterior.
English
Now you try
- Declare an integer, store a value with
←, and output it.
Português
Agora você tenta
- Declare um inteiro, armazene um valor com
←e exiba-o.
Declare Total as an INTEGER, store 8, and output it. · Declare Total como um INTEGER, armazene 8 e imprima-o.
Click Run to see the output here. · Clique em Executar para ver a saída aqui.
Declare Counter as an INTEGER. Start it at 0, add 1, and output it. · Declare Counter como um INTEGER. Comece em 0, adicione 1 e imprima-o.
Click Run to see the output here. · Clique em Executar para ver a saída aqui.