I would like to remind you that there is no requirement to write answers using Standard Reference Language (SRL). The SQA can sometimes refer to Standard Reference Language as “Pseudocode”, however, as I have previously explained this is not the case. Pseudocode is an informal design that explains a programs function using English like structure.
Examples
Read in a number representing a temperature in degrees Celsius and write it out as a value in degrees Fahrenheit. If the Celsius value is c, then the Fahrenheit value, f, is calculated as follows: f = ( 9 / 5 ) * c + 32.
RECEIVE c FROM (INTEGER) KEYBOARD DECLARE f INITIALLY ( 9.0 / 5.0 ) * c + 32 SEND f TO DISPLAY
Read in 10 numbers and write out the average of those numbers.
DECLARE total INITIALLY 0 DECLARE count INITIALLY 0 WHILE count < 10 DO RECEIVE nextInput FROM (INTEGER) KEYBOARD SET total TO total + nextInput SET count TO count + 1 END WHILE SEND total / 10.0 TO DISPLAY
When reading SRL start at the top, working down each line. Take a note on scrap paper of the values given to variables. In SRL constructs start with their NAME and finish with an END and their name. Subprograms can either be a PROCEDURE or FUNCTION, these are named and have parameters (arguments) in parenthesises, functions will have one or more RETURN statements.
Tips
- If you are asked for the results of the program then pay attention to the IF statements to make sure that you branch the program correctly. Check the number of repetitions on loops as well.
- If you are asked to spot an error in the code it will more than likely be a logical error rather than a syntax error.
There is an online Haggis (SRL) checker here, remember you don’t need to write SRL just read it.