LMC Conditional Structures

46 Computer Science Topics

We’ve created 46 modules covering every Computer Science topic needed for GCSE level. These are transferable across AQA, CIE, Edexcel, CIE & Internationally. Suitable for teachers or home educators alike.

Whether you’re a brand new Computer Science teacher, or you’ve been teaching ICT for years, our resources will save you hours and hours of lesson preparation every single week.

View the resources →

The following program will show the use of branch instructions to create an IF/ELSE/ENDIF conditional structure in a program.

Running the program: when prompted, INPUT two numbers, if they are different then the program will OUTPUT a 0 (FALSE) and if they are the same then the program will OUTPUT a 1 (TRUE),

NOTE: The 'if' label has no function and is added to aid clarity.

INP
STA value1
INP
SUB value1
if BRZ else
   LDA false
OUT
BRA endif
else LDA true
OUT
endif HLT
value1 DAT
true DAT 1
false . . .

This content is restricted to subscribers