Skip to content

Instantly share code, notes, and snippets.

View ehlzi's full-sized avatar

ehlzi ehlzi

View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Convert me to ES6</title>
</head>
<body>
Module Main();
// Constants
Constant Integer SIZE = 20;
// Array to hold names
Declare String names[SIZE];
// Get names from user
Call GetNames(names, SIZE);
Module Main();
// Constants
Constant Integer size = 10;
// Array to hold golf scores
Declare Integer golfScores[size];
// Get the golf scores from user
Call GetGolfScores(golfScores, size);
Module Main();
// Array of days in each month
Declare Integer daysInMonth[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
Declare String monthNames[12] = {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"};
// Display days in each month
For index = 0 To 11 Do
Display monthNames[index] + " has " + daysInMonth[index] + " days.";
EndFor;
End Module;
Module Main();
// Constants
Constant Integer num_elements = 7;
// Array to store lottery numbers
Declare Integer lotteryNumbers[num_elements];
// Generate and display lottery numbers
GenerateAndDisplayLotteryNumbers(lotteryNumbers);
End Module;
Module Main();
// Constants
Constant Integer num_choices = 3;
// Local variables
Declare String userChoice;
Declare String computerChoice;
Declare String result;
Module main( )
// Declare variables
Declare Real amountEntered
Declare Real totalEntered = 0
Declare Real amountWon
Declare Real totalWon = 0
Declare String playAgain
Do
// Get user to enter amount of money.
Module main()
// Declare variables to store the user's choice, the computer's choice, and the winner
Declare String userChoice, computerChoice, winner
Declare Integer randomNumber
// Main game loop
Do
// Generate a random number between 1 and 3 for the computer's choice
randomNumber = GenerateRandomNumber(1, 3)
computerChoice = ConvertNumberToChoice(randomNumber)
Module main();
// This module provides a simple addition math quiz
Declare Integer number1, number2, userAnswer, correctAnswer;
// Generate two random numbers
number1 = Random(1, 100); // Random number between 1 and 100
number2 = Random(1, 100); // Random number between 1 and 100
correctAnswer = number1 + number2; // Calculate the correct answer
// Display the quiz question