The sequence control construct is present in all programs from the most simple to the extremely complex. One command is carried out at a time from the beginning to the end of the program in the correct order.
Calculate Total as Number1 + Number2
Display ‘The total is ‘ Total
var Number1 = 0; var Number2 = 0; var Total = 0; Number1 = prompt('Enter the first number:'); Number1 = parseInt(Number1); Number2 = prompt('Enter the second number:'); Number2 = parseInt(Number2); Total = Number1 + Number2; alert ('The total is ' + Total);
The code shown will be executed from top to bottom one command at a time. In the example shown there are three variables declared and used. The program then follows the idea of input, process and output.
Note: Do not worry about what each line of code does at the moment because that it what we are going to look at next.