A brief note on variables, selection and loops in Cambridge pseudocode: data types, declarations, operators, IF and CASE, the three loops, totals and counts, and the usual slips. With practice, a program and questions to check yourself.
A brief note on Variables, Selection and Loops. Read it before a test. Try each question at the end before you open its answer.
NumberOfPlayers: letters and digits, a capital first, no underscore.//.X > Y, never "X is greater than Y".'x'), STRING ("text"), BOOLEAN (TRUE, FALSE). A REAL literal has a digit on each side of the point.DECLARE Counter : INTEGER. Constant: CONSTANT Rate ← 6.50, a literal only.←. Input INPUT Answer. Output OUTPUT "Lives: ", Lives.+ - * /, ^ for a power, DIV and MOD for whole groups and remainders.= < <= > >= <>. Logical: AND, OR, NOT.The program writes the same small task with each of the three loops, so you can see that they agree.
= for assignment. Use ←; = compares.> at a boundary where >= is meant. Test the boundary values.MOD(38, 7) return?FOR K ← 3 TO 15 STEP 4 run?CASE OF Colour with OTHERWISE OUTPUT "None" as its first case.A ← 6, B ← 2. Is A > 5 OR B > 5 TRUE or FALSE?Log in to join the discussion.
Loading…