Variables and DECLARE · 変数と宣言(DECLARE)
This page needs a recent browser (with SharedArrayBuffer support). Please update Chrome, Edge, Firefox or Safari to the latest version. · このページには最新のブラウザ(SharedArrayBuffer対応)が必要です。Chrome、Edge、Firefox、Safariを最新バージョンに更新してください。
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.
日本語
変数は1つの値を格納する
- 変数には名前があり、変更可能な1つの値を保持します。
- 2026年のガイドでは、文字で始まる混合記名法を使用します:
NumberOfPlayersまたはnumberOfPlayers。 - このレッスンはガイドの例と同じく、先頭を大文字にした形式を使用しています。
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.
日本語
DECLARE followed by the arrow
DECLARE Counter : INTEGERは変数を生成し、その型に名前をつけます。- 代入演算子は
←です。右側の値を格納します。 =は値を格納する方法ではありません。=はテスト内で「等しい」を意味します。
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
_.
日本語
注意
- 変数を使用する前に宣言してください。
- 識別子(Identifier)は文字で始まります。数字が続くことができます。ガイドでは
_も許可されています。
English
Common mistakes
Counter ← 1stores 1.Counter = 1is not an assignment.- One variable holds one value. Assigning again replaces it.
日本語
よくあるミス
Counter ← 1は1を格納します。Counter = 1は代入ではありません。- 1つの変数は1つの値を持ちます。再度代入すると置き換わります。
English
Now you try
- Declare an integer, store a value with
←, and output it.
日本語
あなたも試してみよう
- 整数を宣言し、
←で値を格納して出力します。
Declare Total as an INTEGER, store 8, and output it. · TotalをINTEGERとして宣言し、8を格納して出力します。
Click Run to see the output here. · 実行ボタンをクリックして出力を確認してください。
Declare Counter as an INTEGER. Start it at 0, add 1, and output it. · CounterをINTEGERとして宣言します。初期値を0にし、1を加えて出力します。
Click Run to see the output here. · 実行ボタンをクリックして出力を確認してください。