Programming is writing instructions that a computer can carry out. This topic covers the building blocks found in every language. Variables and constants store data of a type such as integer, real, string or Boolean. Sequence, selection and iteration control the order of steps: IF statements choose, and FOR, WHILE and REPEAT loops repeat. Arrays hold lists of values, and procedures and functions break a long program into parts. Programs also validate input, handle strings and read and write files. You practise these in pseudocode and in Python.
Number, so the condition stays TRUE for ever. Adding 1 inside the loop makes the condition become FALSE after the value 5 is output.
With < the loop still never changes Number. Starting at 0 does not help either. A REPEAT loop needs UNTIL and a changing variable too.Log in to join the discussion.
Loading…