Professional Documents
Culture Documents
G9 - Block 2 - Week 1 - WS4 - Constant
G9 - Block 2 - Week 1 - WS4 - Constant
Contents
1. Constants in Visual Basic
2. Constant Declaration
3. Visual Basic Constant Examples
Prepared by P a g e |1
Subject Grade Date Block week Unit/Lesson/Topic Study sheet
ICT 9 2 1 Constant 3 out of 16
Objective: • Differentiate between variables and constants
Student Name: ………………………………………………………………………………………………………………………. Class 9
Prepared by P a g e |2
Subject Grade Date Block week Unit/Lesson/Topic Study sheet
ICT 9 2 1 Constant 3 out of 16
Objective: • Assign values to variable or constants
Student Name: ………………………………………………………………………………………………………………………. Class 9
Constant Declaration
• You declare a constant with the Const statement, using the same guidelines you
would for creating a variable name.
EX:
Const name As String = "Suresh Dasari"
Const location As String = "Hyderabad"
Const age As Integer = 32
Prepared by P a g e |3
Subject Grade Date Block week Unit/Lesson/Topic Study sheet
ICT 9 2 1 Constant 3 out of 16
Objective: • Assign values to variable or constants
Student Name: ………………………………………………………………………………………………………………………. Class 9
Module Module1
Sub Main)(
' Constant
Const name As String = "Ghadeer Mohamed"
Const location As String = "Qena"
Const age As Integer = 27
Console.WriteLine("Name: " & name)
Console.WriteLine("Location: " & location)
Console.WriteLine("Age: " & age)
Console.ReadLine()
End Sub
End Module
Module Module1
Sub Main)(
Const PI As Single = 3.14149
Dim radius, area As Single
Console.Write("Enter the radius value : ")
radius = Console.ReadLine
area = PI * radius * radius
Console.WriteLine()
Console.WriteLine("Area = " & area)
Console.ReadKey()
End Sub
End Module
Prepared by P a g e |4