Page 10 - Touchcode_C7_Flipbook
P. 10
A variable which is declared but is not initialized ever has an undefined value, but you can
assign it a value in later steps by using assignment operators.
Consider example 1, in which two variable ‘x’ and ‘y’ are declared. Variable ‘x’ stores a value
‘20’ and variable ‘y’ stores a value ‘30’.
Now, when the program is executed, the memory location named as ‘x’ will hold a value ‘20’
and memory location named as ‘y’ will hold a value ‘30’.
Coding fact
In 16 century, François Viète introduced the concept of presenting numbers
th
both known and unknown by letters in programming, which are nowadays
called as variables.
As you already know that a variable cannot be used unless a value is assigned to it. The value
of a variable can be initialized to ‘Null’, which is also a value. Variable which is defined with
the ‘Null’ value is a variable which is not initialized and also it does not hold any value, not
even ‘Null’. In some programming languages like Python, there is no command to declare
the variables. A variable is created at the moment, when you first assign a value to it.
Example 2: Declaring a variable in Python.
x=7
y=“Orange Education”
Coding Task 01 Subject Enrichment
To create and initialize a variable
In this task, you will learn to create and initialize a variable in MakeCode Arcade.
To perform the task, follow these steps:
Step 1: Visit the link: https://arcade.makecode.com/. Click on ‘New Project’, give a name
to your project, ‘To create a variable’, and click on ‘Create’.
8 Touchcode-VII

