0% found this document useful (0 votes)
8 views3 pages

03 Variables 4a7ed66b804d

The document discusses variables in programming and how they are used to store and recall data. Variables act as boxes that save data entered, and they can be declared to form storage locations that programs can then use to perform actions on the stored data as needed.

Uploaded by

Zsombor Film
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views3 pages

03 Variables 4a7ed66b804d

The document discusses variables in programming and how they are used to store and recall data. Variables act as boxes that save data entered, and they can be declared to form storage locations that programs can then use to perform actions on the stored data as needed.

Uploaded by

Zsombor Film
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

these variables.In other words; we put the numbers into the boxes.

And when we
Subject: Variables want them we recalled these numbers and used them.
Overview
Commands to be Used
Variables are boxes which save the data we enter for us. By declaring a
variable we form a box for ourselves, then when we need it, we can recall the data The variables they will use in order to complete the tasks and their usage forms.
from the box and use it. We can use the data in the boxes we formed when we
need it by recalling them again and again. Blocks and Button icons to be used in the training about this subject

In order to perform an action the first thing to be done is to store that data.
When we want to perform an action we recall the data from the storage and Block Explanation
perform the required actions. In the programming languages, we use the variables The name of the variables may be letters such as a,b,c
in order to express the data in the storage. To sum up; they are the declarations or words in a similar way. The important thing is to
that we make for storing the data processed in the programming language inside use the name which we use to indicate the variable in
the storage of the computer. the beginning in the same way when we recall it.

Activity
Sample usage (Python):
Suppose that we have two numbers and we add these two numbers and Button a=5
say the result. The action that we must perform will be formed from the steps forward(a)
similar to the ones below.
Sample usage (Javascript):
 say a number (3) var a = 5
 say another number (5) forward(a)
 add these two numbers (3+5)
 say the result (8)
BLOCK
 3+5=8
When a number is said, we stored that number to a part of our memory. Usage Explanation
And when the second number is said we also recorded it to another part of our
Variable name
memory. In the next stage we added the two numbers using the addition method
that we had learnt before.
At the end we recorded these values that we added to another part of our
memory. Then we said this result we stored aloud.
Consider that the numbers that will be added for this action change
continuously. Now here at this point variable declaration gets involved. As in the Value given to the variable
example above, we declared two different variables and stored the numbers in

codementum.com
PYTHON Usage Variable
Usage Explanation
Variable name

Variable name Value given to the variable

Value given to the variable Variable declaration Variable name


Variable declaration değer

Usage of variable

Usage of Variable

Erraneous writing forms

Erraneous writing forms


JavaScript

Python

Why is it wrong? Why is it wrong? Correct form:


Formed variable is It is required to be used It is correct due to the
missing because it is not with an equal sign in the declared variable used
being used within any form of “a=3” while the with the equal sign in the
expression. variable is formed and form of “forward(a)”.
value is transferred.

JAVASCRIPT

codementum.com
Sample Solution: Scene 23

Algorithm Block Python Javascript

 Start a=5 var a = 5


 declare variable a repeat 3: repeat(3){
 give variable a value 5 forward(a) forward(a)
 3 times witihin Repeat turn(right) turn(right)
 move "a" square forward }
 Turn right

codementum.com

You might also like