Variables and 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.
עברית
משתנה מאחסן ערך אחד
- למשתנה יש שם והוא מחזיק ערך אחד שיכול לשנות.
- מדריך 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, ולאחר מכן החץ
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
_.
עברית
שימו לב
- הכרז משתנה לפני השימוש בו.
- מזהה מתחיל באות. מספרים יכולים לבוא אחר כך. המדריך מאפשר גם
_.
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אינה הצבה.- משתנה אחד מחזיק ערך אחד. הצבה חוזרת מחליפה אותו.
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. · לחץ על הרץ כדי לראות את התוצא כאן.