Page 145 - Computer Software Application TP - Volume 1
P. 145
COMPUTER SOFTWARE APPLICATION - CITS
EXERCISE 39 : Programming with Control Flow statements
Objectives
At the end of this exercise you shall be able to
• use different types if conditional statements
• use different types of loop statements.
Requirements
Tools/Materials
• Desktop / Laptop with latest configuration
• Text editor
• Web browser
Procedure
TASK 1: Using if statement
1 Open the text editor
2 Write the following codes
<html >
<head>
<title> if statement </title>
</head>
<body>
<script>
let age = 20;
if (age >= 18)
{
console.log(“You are eligible to vote.”);
}
</script>
</body>
</html>
3 Save the program as a .html file
4 Open the html file with a web browser
5 Go to the browsers console tab and verify the output.
130