0% found this document useful (0 votes)
3 views13 pages

Lesson 2 - Using Variables To Store Data

The document provides an overview of variables and constants in programming, including their definitions, naming conventions, and data types. It outlines the rules for naming variables and includes examples of declaring both variables and constants. Additionally, it contains true/false statements to test understanding of the concepts presented.

Uploaded by

Eugene Valdoz
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)
3 views13 pages

Lesson 2 - Using Variables To Store Data

The document provides an overview of variables and constants in programming, including their definitions, naming conventions, and data types. It outlines the rules for naming variables and includes examples of declaring both variables and constants. Additionally, it contains true/false statements to test understanding of the concepts presented.

Uploaded by

Eugene Valdoz
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/ 13

1.

IDE
2. Parts of IDE
3. Events
4. Structure of an Application
After this session, you will be able to:
1. Define variables.
2. Identify the different type of variables.
3. Use variables in naming convention.
A variable is simply a named memory location and the value may
change during the course of execution. It could be during calculations,
information on a customer, and so on.

When naming a variable, you must follow a few rules:


■ It must start with an alphabetic character.
■ It can only contain alphabetic characters, numbers, and underscores.
■ It cannot contain a period.
■ It cannot be more than 255 characters.
■ It must be unique within the current scope.
The data type determines how much memory is allocated to store data in.
The following are some common examples of declaring variables:

Dim x as Integer
Dim y, z as Single
Dim str as string
Constants are similar to variables. The main difference is that the
value contained in memory cannot be changed once the constant
is declared.

Here are some examples of declaring constants:


 Const X As Integer = 5
 Const str As String = "Company Name"
 Const X As Double = 0.12
Direction: Write T if the statement is true and F if the statement is false.

1. Variables must start with an alphabetic character.


2. Variables can only contain alphabetic characters, numbers, and underscores.
3. Variables can contain a period.
4. The value of a constant may change during the course of execution.
5. Variables can be more than 255 characters.
6. Variables must be unique within the current scope.
7. Boolean type of data has a value of true or false.
8. String type of data can only accept maximum of 255 characters.
9. Integer type of data is for numbers with decimal points.
10. The value of a variable may not change during the course of execution.
Direction: Write T if the statement is true and F if the statement is false.

1. Variables must start with an alphabetic character. (T)


2. Variables can only contain alphabetic characters, numbers, and underscores. (T)
3. Variables can contain a period. (F)
4. The value of a constant may change during the course of execution. (F)
5. Variables can be more than 255 characters. (F)
6. Variables must be unique within the current scope. (T)
7. Boolean type of data has a value of true or false. (T)
8. String type of data can only accept maximum of 255 characters. (F)
9. Integer type of data is for numbers with decimal points. (F)
10. The value of a variable may not change during the course of execution. (F)
1. Draw the given
form and define
each control
inside.
2. Insert a code that
illustrate the use
of variables.

You might also like